Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

FILE_ADD_TO_DB is using the wrong path

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    FILE_ADD_TO_DB is using the wrong path

    I have a script that runs when my application starts up. If I install a patch and my app doesn�t match the current patch id, the script runs. A portion of the script checks for the existence of a table. If the table does not exist, my script adds the table and its fields.

    The tables that xbasic is creating and adding to the database all have the wrong path. Somehow, alpha is picking a legitimate path with the correct table name, but it�s not the current path of the opened database. Can anyone see anything wrong with this code?

    Code:
    'if the Table 'wk1' is missing from the Database, add it
    tblName = "wk1"
    tblFields = <<%a%
    Env,C,4,0	
    wk1,N,15,2	
    Date,D,8,0	
    Sequence,N,7,0	
    Checknum,C,15,0	
    Special,C,20,0	
    Amount,N,11,2	
    Origenvnumber,C,4,0	
    Posted_Date,D,8,0	
    Arce,L,1,0		
    %a%
    
    Check_Table(tblName, tblFields)
    Code:
    FUNCTION Check_Table as L ( tblName as C, tblFields as C )
    	
    	dim fTbl as P
    	'if the table 'tblName' is missing, add it.
    	on error goto table_missing
    	fTbl = table.open(tblName,file_rw_shared)
    	on error goto 0
    	fTbl.close()
    	goto cleanup
    	
    	table_missing:
    	addtbl=a5.Get_Path()+chr(92)+tblName+".dbf"
    	create_table(addtbl,tblfields)
    	FILE_ADD_TO_DB(addtbl)
    	resume 0
    		
    	cleanup:
    	
    	END
    	
    END FUNCTION
    Attached Files
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: FILE_ADD_TO_DB is using the wrong path

    Your code seems to run fine here. V5, V8, and V10.5 though I did run it all in one script.
    There can be only one.

    Comment


      #3
      Re: FILE_ADD_TO_DB is using the wrong path

      Hi Stan,

      I think I figured out the error of my ways. That said, I�m not sure how to resolve what I�m trying to accomplish.

      I have a working application. I develop an improvement which requires the addition of another table. I used xbasic to add the new table. I do this on my developmental application.

      Now I want to distribute an upgrade patch to different clients. What I have been doing was to backup my developmental app unmarking the data files only. When the client runs a restore, the new tables have retained the original path of my developmental application. Humm.

      I guess I would have to unmark all references to the new tables, but wouldn�t I lose the field rules and forms, browses, etc.??

      I�m trying to make this very easy for the client as most are not that computer literate.

      Ron
      Alpha 5 Version 11
      AA Build 2999, Build 4269, Current Build
      DBF's and MySql
      Desktop, Web on the Desktop and WEB

      Ron Anusiewicz

      Comment


        #4
        Re: FILE_ADD_TO_DB is using the wrong path

        Hi Ron

        FILE_ADD_TO_DB() must be run on the client side before the version update that delivers it. That can be problematic sometimes.

        The solution now is for you to send a new update containing
        Code:
        FILE_DROP_FROM_DB("wk1.dbf") 
        FILE_ADD_TO_DB("wk1.dbf")
        No explicit paths!. Alpha knows the location of the table to drop, then uses the default path to add.

        Comment


          #5
          Re: FILE_ADD_TO_DB is using the wrong path

          Ron's solution should work but I think there's a much better way....

          This is one of the reasons I love my 3rd party installer. I use Astrum but there are probably others that are free and could also handle this situation for you.

          This in not exactly what I do but the basics are the same:

          I create an install routine that contains everything - data files (includes index and memo files), data dictionaries, sets (really just more data dictionaries), and the adb and al* files. Then - and this is what A5's installer can't do - I set all the data files to "Never Overwrite". Now adding a new table is simple. Before running the install creator program to build the next installer, I simply delete the test records in the new table and add that table to the list of Files to Install in the installer setup dialog (along with all the data dictionaries for that table, of course) and mark it as "Never Overwrite". Now the table will be installed automatically the first time the install is run but never again after that - unless the table is deleted, of course.

          This completely eliminates the need to drop and add tables to the db. It also eliminates the need for your Check_Table routine. In fact, if your user deletes a table for some reason and doesn't have a backup, all they need to do is re-run the latest install routine - only the missing tables will be replaced; not the existing tables. The data dictionaries, etc. will also be replaced but so what - they are being replaced with exactly the same files as the last time the customer ran that install.

          FWIW:

          I also break my install list into multiple "install items" but they are all defined as "Minimum files required for the application to run". The reason for separating them is just for my own sanity when trying to verify what has been included. I break mine into:

          Application Files - the .adb and .al* files
          Data Files - .dbf, .cdx, and .fpt
          Data Dictionaries - .dd*
          Sets - .se*
          Addins (if I'm including any - typically my backup and/or registration addin)
          and usually something like "Misc" or "Support" which is anything else needed.

          In addition to making it easier to see what files are included, this also makes it easy to select all the files in the Data Files group and set them to Never Overwrite.

          I also found out that the install runs faster if the other groups are set to Always Overwrite. Apparently that eliminates the time required to decide what to do. Even if nothing actually needs to be overwritten, the Always Overwrite was still faster last time I tested it.

          Comment


            #6
            Re: FILE_ADD_TO_DB is using the wrong path

            Cal
            "The data dictionaries, etc. will also be replaced but so what - they are being replaced with exactly the same files as the last time the customer ran that install."
            Correct me here but isnt that where Ron got the problem in the first place, he creates the file correctly in place but the data dictionaries etc have the location as elsewhere.?
            I do think Astrum installer sounds great- i keep saying I must look into it.

            Comment


              #7
              Re: FILE_ADD_TO_DB is using the wrong path

              The problem is that there is no table when the application first opens. The table is created later by the script. Even though the data dictionaries are there, A5 is looking for the table and it isn't there. The "what's on the control panel" issue happens before the script runs.

              By putting the table in as part of the initial install, A5 finds it and correctly adds it to the Control Panel. Or perhaps it would be more correct to say that A5 correctly updates the control panel to show the correct path.

              Re: I do think Astrum installer sounds great- i keep saying I must look into it.
              There is no way I would even consider going back to just using zip files for installations and updates. If I couldn't use Astrum for some reason, I'd be looking for something similar - free would be nice but I'd pay for it if that's what it took to find the features I want. I feel that it saves me lots of time and even more frustration. Sure, it takes awhile to set up an install the first time (and even longer the very first time you use the program) but once an install "definition" has been created, it seldom needs to be changed and future updates are very easy to create - in some cases it's as simple as opening the install creator program and clicking the "create new install" button. (Although I usually at least change the version number and typically update my ReadMe to describe the latest changes.)

              Comment


                #8
                Re: FILE_ADD_TO_DB is using the wrong path

                Thanks,

                You've given me something to think about.

                Ron
                Alpha 5 Version 11
                AA Build 2999, Build 4269, Current Build
                DBF's and MySql
                Desktop, Web on the Desktop and WEB

                Ron Anusiewicz

                Comment

                Working...
                X