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

Need a variable to persist from database to database?

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

    #16
    Re: Need a variable to persist from database to database?

    Originally posted by jjfcpa View Post
    I can't NOT tell whether I'm running DB 1 for the first time (actually I can, because the eval_valid("c_do_what.varname") properly returns false), but when it returns from DB 2, it still returns false.
    It shouldn't.
    My script says:
    if eval_valid(c_do_what.varname)=.f.
    The first time, it will be false and the rest of the code will run creating the variable and setting it to "Startup".
    However; when you return to DB 1, it will not be false since the variable already exists.
    If it returns false, it must be for some other reason.

    Comment


      #17
      Re: Need a variable to persist from database to database?

      Originally posted by G Gabriel View Post
      It shouldn't.
      My script says:
      if eval_valid(c_do_what.varname)=.f.
      The first time, it will be false and the rest of the code will run creating the variable and setting it to "Startup".
      However; when you return to DB 1, it will not be false since the variable already exists.
      If it returns false, it must be for some other reason.
      I agree 100%. Here is my code, and it's not working!

      if .not. email_valid("c_do_what.varname")
      ui_msg_box("BACK IN ALD","Declaring add in variable")
      if ui_msg_box("DECLARE","Do you wish to declare add in variable?",UI_QUESTION_SYMBOL + UI_YES_NO) = UI_YES_SELECTED
      dim c_do_what as P
      c_do_what = addin.variables()
      c_do_what.varname = "Startup"
      end if
      end if

      For some reason, it gets inside this "if" statement even when it returns from DB 2.
      John J. Fatte', CPA
      PRO-WARE, LLC
      Omaha, NE 68137

      Comment


        #18
        Re: Need a variable to persist from database to database?

        OK John.. it's time for a coffee break!
        How did email_valid get in here?

        Comment


          #19
          Re: Need a variable to persist from database to database?

          Originally posted by G Gabriel View Post
          OK John.. it's time for a coffee break!
          How did email_valid get in here?
          You're right... I took a coffee break and came back and tried some other things.

          This code is not complicated... at least I don't think so, but the "eval_valid" (sorry about the email_valid, my typo) is not working.

          Can I zip up my databases and email them to you? Send me a private msg with email address and I will email to you and you'll see what I mean.

          Keep in mind everything works great when I go from db 1 to db 2, it's going back where everything falls apart.

          The "eval_valid("c_do_what")" is returning false everytime I come back to db 1. Not good!
          John J. Fatte', CPA
          PRO-WARE, LLC
          Omaha, NE 68137

          Comment


            #20
            Re: Need a variable to persist from database to database?

            John:
            It's my fault.
            You need to enclose the variable in quotations:
            should be:
            Code:
            if eval_valid("c_do_what")=.f.
            dim c_do_what as P
            c_do_what = addin.variables()
            c_do_what.varname = "Startup"
            end if
            I just tested it. It works.

            Comment


              #21
              Re: Need a variable to persist from database to database?

              The correct way to do what you are trying is to always dim c_do_what, your pointer to the addin variables. Then use that pointer to see if the value you are trying to set is there yet:
              Code:
              dim c_do_what as p = addin.variables()
              if .not. eval_valid("c_do_what.varname")
                  dim c_do_what.varname as c = "Startup"
              end if
              Alternatively, you can skip the eval_valid() altogether and use the DEFAULT keyword with your dim statement. This will set the value if one isn't already there, but leave any existing value unchanged:
              Code:
              dim c_do_what as p = addin.variables()
              dim c_do_what.varname as c = DEFAULT "Startup"

              Lenny Forziati
              Vice President, Internet Products and Technical Services
              Alpha Software Corporation

              Comment


                #22
                Re: Need a variable to persist from database to database?

                Once upon a time, I read the initialization parameter of DIM. Evidently it didn't stick in my head as I didn't envision what to use it for. This is a perfect example.
                Nice touch Lenny.

                Comment


                  #23
                  Re: Need a variable to persist from database to database?

                  Originally posted by Lenny Forziati View Post
                  The correct way to do what you are trying is to always dim c_do_what, your pointer to the addin variables. Then use that pointer to see if the value you are trying to set is there yet:
                  Code:
                  dim c_do_what as p = addin.variables()
                  if .not. eval_valid("c_do_what.varname")
                      dim c_do_what.varname as c = "Startup"
                  end if
                  Alternatively, you can skip the eval_valid() altogether and use the DEFAULT keyword with your dim statement. This will set the value if one isn't already there, but leave any existing value unchanged:
                  Code:
                  dim c_do_what as p = addin.variables()
                  dim c_do_what.varname as c = DEFAULT "Startup"

                  Lenny

                  Nicely done. Works perfectly. I hope this code will make it into the V10 help file, because I reviewed it carefully and tried all the code that I could find... to no avail.

                  Thank you for your help.

                  For those that are interested, I'm attempting to create a loader database that resides in a public folder. The shortcut installed for the application will always access the loader database and from there it will do a couple of things before loading the application database.

                  1. It will display a splash screen.

                  2. It will check an FTP site for updates.

                  3. If there is a new update, it will download and ask the user if it wants to install the update. If they do, it will update the application database.

                  After loading the application database, the loader database will be loaded again if they select any of the following options.

                  1. Move the database to another folder.
                  2. Backup the database. It will keep track of the backup folder.
                  3. Restore a backup database.

                  One of the reasons I decided to do this was because I wanted to be able to gracefully recover if the user attempts to load an application and for one reason or another, the application database is not found. My loader database will handle this by allowing the user to specify a different folder in those cases where the database has been moved or if they have a temporary copy somewhere else that they want to use... say to print reports.

                  A perfect example of when this will happen is if they have their application database on a network drive and they are not connected to the network (perhaps because they are on a laptop) and away from the office. I do this quite often. I always have a backup copy of the database on my local drive that I access for references purposes (not to make changes), so when I am away from the office, I just use that one instead of the one on the network. The next time I'm connected to the network and startup the application, the database on the network is selected as it should be.

                  My loader database will handle this without any problem.

                  Not sure if anyone else has spent any time create a database like this, but I'd be happy to exchange ideas if they have. I will also be happy to share my database loader when I finish it up.

                  Thanks to Lenny's code, I'm back on track and can see that this will work exactly the way I wanted it to.

                  Forgot to mention that the loader database will work with any application database with a minimum of changes to the main database.
                  John J. Fatte', CPA
                  PRO-WARE, LLC
                  Omaha, NE 68137

                  Comment


                    #24
                    Re: Need a variable to persist from database to database?

                    Not really sure why you can't do all these with one DB?
                    Instead of a "Loader DB", just use a form or an xdlg. Having 2 DB's loaded is a RAM hog and considerably slow especially on a network.
                    If the object is to be able to work "Offline":
                    1-That doesn't help much because if you are "viewing only", you might not be viewing the most recent editions.
                    2-You still can work "Offline" with the single DB if viewing the most recent editions is not an issue and you could also make editions and synch the DB later.

                    Comment


                      #25
                      Re: Need a variable to persist from database to database?

                      Originally posted by G Gabriel View Post
                      Not really sure why you can't do all these with one DB?
                      Instead of a "Loader DB", just use a form or an xdlg. Having 2 DB's loaded is a RAM hog and considerably slow especially on a network.
                      If the object is to be able to work "Offline":
                      1-That doesn't help much because if you are "viewing only", you might not be viewing the most recent editions.
                      2-You still can work "Offline" with the single DB if viewing the most recent editions is not an issue and you could also make editions and synch the DB later.
                      Gabriel

                      AS you can probably tell, I'm still a novice with A5. I've been programming with other db oriented languages for over 25 years, and I'm intrigued by what A5 has to offer. Especially on the web site of things.

                      As I mentioned, I want to provide a way for my application to gracefully recover from the DB not being available... take the case where the main DB is on a network and is accessed from there normally, but they take their laptop home and try to run the application. With one DB, what would happen in that case if you were running the runtime??? I honestly don't know, but I'm guessing there would be no way to recover without changing the shortcut... not very elegant, especially compared to what we've been offering our clients.

                      I also think that allowing the user to perform some housekeeping things, like making a copy of the DB, updating the DB after downloading a more current copy of the DB from a website, etc. would best be handled by a housekeeping DB.

                      And since the housekeeping DB will only be used so infrequently, except for the Startup routine, I don't really see how speed will be an issue.

                      If you have real experience in this area, I'm all ears.

                      I really appreciate your contributions to this thread.
                      John J. Fatte', CPA
                      PRO-WARE, LLC
                      Omaha, NE 68137

                      Comment


                        #26
                        Re: Need a variable to persist from database to database?

                        Gabriel

                        I forgot to mention that one of the other huge benefits to doing this in a separate database is that it makes it portable across applications.

                        In the development language that I am coming from, it's possible to create procedure files and reference forms that reside in a separate application. They are compiled in when your application is built. The beauty of this is that these routines - error routine, printing routine, print-to-file routine, backup routine, etc. - can be perfected once and then shared by a host of applications.

                        This seems to be a real shortcoming of Alpha, and what I'm attempting to do is circumvent this shortcoming in the only way that I know how (right now).
                        John J. Fatte', CPA
                        PRO-WARE, LLC
                        Omaha, NE 68137

                        Comment

                        Working...
                        X