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()

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

    file_add_to_DB()

    Have an app I've distributed and have added a couple of new tables. Am wanting to put in my autoexec script a way to check to see if the users current version includes these two tables. My question is will just using this function add all the necessary files to their application, i.e. .cdx etc.??
    Thanks.
    Ernie

    #2
    Re: file_add_to_DB()

    Using what function?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    Comment


      #3
      Re: file_add_to_DB()

      The topic of this thread.

      Comment


        #4
        Re: file_add_to_DB()

        Don't know if this is the best way to do this or not. I created a little zip file of the files I need (10 total) and included it in the update zip file. Then in the autoexec, I check to see if one of those files exists (either they all exist or none of them). If not, then unzip the little zip file.
        If anyone has a better way, please let me know.
        Ernie

        Comment


          #5
          Re: file_add_to_DB()

          I have done the same Ernie in simply testing for the existence and if the table is not present, add it....works just fine....are you having issues with it or just curious as to other possible ways?
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: file_add_to_DB()

            Hi Mike. I was just looking for a simple way to get this done. It seems the file_add_to_db() function is only a way of having it show up in the Control Panel and therefore it must exist on the users machine somewhere. In my case, if the dbf file is not on the users machine, using this function would do nothing because it would have none of the structural info. Only the name. I had thought about just adding the files to the zip itself, but then the install would overwrite what was on the users machine, if those files had already been installed by a previous install. My previous install did include them because it was the first update after adding them. This is a subsequent update.
            So I guess my real question now is, how to handle this? We have the functions to add fields to tables if they haven't already been added, so was looking for similar functions to add tables if they don't exist.
            Ernie

            P.S. Just found the create_table() function. Don't know why I didn't see that in all my research yesterday. I think I got sidetracked when I saw the file_add_to_db() function.

            Comment


              #7
              Re: file_add_to_DB()

              Ernie,
              if you are looking to test for the presence of the table in the application, this will work.

              Code:
              dim vtable as C="staff"
              
              if is_one_of(vtable,a5.Table_Enum())
              	msgbox("Table is in the application")
              else
              	msgbox("Table ain't here, Pal, so don't do it!")
              end if
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: file_add_to_DB()

                Mike,
                This is what I've got in my autoexec script.

                Code:
                dim vFilename as c
                dim zip_Filename as c
                dim vFilemask as c = "*.*"
                
                vFilename = datapath+"\expense_net.dbf"
                zip_Filename = datapath+"\net.zip"
                if file.exists(vFilename) = .F. then
                     file.unzip(zip_Filename,vFilemask,datapath)
                end if
                The net.zip file is included in the application zip update. It contains the 10 files I need to load on the users machine if they haven't already been loaded.

                Ernie

                Comment


                  #9
                  Re: file_add_to_DB()

                  looks like it would work just fine Ernie. In your case you stated that if one existed all existed so no need to test for each. But you should have all the files in the zip file that correspond to a table/set....not just the dbf.....is the way I have done it.
                  Mike
                  __________________________________________
                  It is only when we forget all our learning that we begin to know.
                  It's not what you look at that matters, it's what you see.
                  Henry David Thoreau
                  __________________________________________



                  Comment


                    #10
                    Re: file_add_to_DB()

                    Thanks, Mike. My only concern in doing it this way is that it leaves the zip file on their machine. I guess I could write the code to delete it after the unzip, if it was successful. I'm going to take a look at the create_table() function. This would solve the problem of my concern. Just takes a little more time to write the extra lines of code for the fields.
                    Ernie

                    P.S. Just thought that I would have to create the indexes also. This may be more trouble that it is worth. Maybe deleting the zip file would be the way to go.

                    Comment


                      #11
                      Re: file_add_to_DB()

                      If you are sure this is a one time deal, you could just delete the zip after the addition if missing or right away if the exist says the table already is there.....but then what about the autoexec? It will still be testing for the table and should find it I guess...but if worried about cleanup..... :)
                      Mike
                      __________________________________________
                      It is only when we forget all our learning that we begin to know.
                      It's not what you look at that matters, it's what you see.
                      Henry David Thoreau
                      __________________________________________



                      Comment


                        #12
                        Re: file_add_to_DB()

                        Mike,
                        Here's "my final answer".

                        Code:
                        dim vFilename as c
                        dim zip_Filename as c
                        dim vFilemask as c = "*.*"
                        dim vSuccess as L
                        
                        vFilename = datapath+"\expense_net.dbf"
                        zip_Filename = datapath+"\net.zip"
                        if file.exists(vFilename) = .F. then
                        	vSuccess = file.unzip(zip_Filename,vFilemask,datapath)
                        else
                        	file.remove(datapath+"\net.zip")
                        end if
                        if vSuccess = .t. then
                        	file.remove(datapath+"\net.zip")
                        end if
                        Tested just fine. Lots less work.
                        Ernie

                        Comment


                          #13
                          Re: file_add_to_DB()

                          Well, may have run into a road block here in including my little zip file with the app zip update file. Evidently, when you include a "zip" file in your zip, it puts that zip file in a folder it creates called "Install". However, when you unzip the main zip file, it doesn't extract that folder. So can't get to the zip file within the main zip.
                          Here is the code to unzip:

                          Code:
                          dim filename as c
                          filename = ui_get_file("Select Backup File...","ZipFiles (*.zip)",backup_folder+ chr(92) + app_filename)
                          if filename = "" then
                              msgbox("Cancelled","Restore Cancelled.")
                              end
                          end if
                          
                          if file.unzip(filename,filemask,datapath)
                              msgbox("Success...","Files restored successfully.")
                          else
                          	msgbox("Unsuccessful...","There was a problem restoring the Files.")    
                          end if
                          Any ideas on how to make this work?
                          Thanks.
                          Ernie

                          P.S. I uplink the zip file I create from within alpha5 to my web server. THen have code to download the zip to the users computer. Then they go through a basic restore from that zip file. The above code is the restore code I have on a button.

                          LATER: Well, I just zipped up the files I needed using 7-zip. Would rather use alpha5, but maybe in this situation, it's not possible.
                          Last edited by enstorms; 08-19-2010, 06:00 PM.

                          Comment

                          Working...
                          X