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

Global variable declaration

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

    Global variable declaration

    I am creating a form that has several xbasic scripts that need to talk to on another via variables. Now there are several ways to declare global variables in alpha 5 and I wonder if they are all equivelent and how they differ.

    One is using the variable declaration button on the task bar.
    Two is on the varaibles tab of the script editor.
    Third is as a Dim global in a script.

    What is the difference?
    When would you use one over the other?

    #2
    RE: Global variable declaration

    Hi Jesse,

    >>What is the difference?
    When would you use one over the other?

    Comment


      #3
      RE: Global variable declaration

      Jesse,

      Jim is right; you should only use global variables when the input is dynamic (input -- ostensibly from the user -- is needed by the script to continue processing) or when passing a value around, such as field names for report content, and they need to be persistent throughout your application.

      Than being said, I use 200-300+ global variables in an application without mishap. (This is because I have no way of anticipating the kind of table that I'll be working on.)

      It is, as Jim said, a good idea to load them in your autoexec script because, once they're declared, you can use them in several different scripts interchangeably, without having to be sure the are declared in each. (This is especially true if the scrips might be run in different combinations and sequences at various times.)

      It is also a good idea to declare global variables BEFORE you start designing forms, reports, etc. so that you can treat them just like "real" objects, like when placing a field on a form. It will save you a lot of time.

      Note also, that if you are going to use a lot of GV's, it's a good idea to set up some sort of standardized naming convention so they don't get tangled up, oh, and comment them heavily in the autoexec script as well (in six months you'll thank me)...

      Good question. Good luck.

      Best regards,

      Geoff Hollander

      Comment


        #4
        RE: Global variable declaration

        In a networking environment with a lot of users do you have problems with global variables messing things up? For example if you have a bunch of people doing data entry using essentially the same dataentry form and lets say that global variables are used to hold and transform values within these forms, does A5 keep these values related to each user or is it possible for the values to change depending of which user has control of it at any particular time?

        This is my one greatest paranoia about using global variables although up to this point I havn't used any session or layout level variables. The fact is that I can't get my head around how to use them.

        I have a sales entryform that contains a button that pops up a small form that is linked to my inventory table. This small form is used to allow the user to reserve or hold a quantity of stock for a pending order. The form displays quantity on_hand, the current number of items on hold and other inventory related data. I also have two variable fields on the form v_new_hold and v_hold_more both are global. The idea is that the user upon opening this form would enter into "v_hold_more" the number of items he would like to add to the current hold level. In the onchange event of v_hold_more this amount would be added to the current level and the amount would end up in v_new_hold
        When this form is closed the global variable v_hold_more is picked up by the calling form. When the user decides to save the sales order entry, I insert the v_hold_more value to the current sales order to show how many items were held and I add the value of v_hold_more to the hold field on the inventory table.

        The question is, how do you set up v_hold_more as anything other than a global variable so that it can be passed from the "Hold" form back to the calling "Salesentry" form.

        I've spent countless hours at this and I feel that I need one of those whack on the side of the head enlightenments.

        Comment


          #5
          RE: Global variable declaration

          Greg:

          Each Alpha session running on a network is "insulated" from the other so that the global variables in each session is independent of the global variables in all other sessions. Obviously the sessions interact to a degree as records are entered and changed but the database engine and the network OS take care of that. Like Geoff, I use globals pretty extensively and providing you don't get careless with naming you shouldn't have a problem.

          In the case you describe you can certainly use a global variable, though it is not necessary to do so. You can pass form variable values back and forth by addressing the layout variable object on each form. The following is a pretty crude example: this code could be on a button on FormA. FormA has a numeric variable object called nVar and FormB has an identially defined numeric variable object also called nVar, then

          f1=parentform.this
          f2=Obj("FormB")
          if is_object(f2) then
          goto nextstep
          else
          f2=form.load("FormB")
          f2.show()
          f2.activate()
          end if
          nextstep:
          f2:nVar.value=f2:nVar.value+f1:nVar.value
          f2.show()
          f2.activate()
          f2:nVar.refresh()
          would add the value of the variable on Form A to the variable on Form B where each nVar is defined as a layout variable, then show the results.

          Finian
          Finian

          Comment


            #6
            RE: Global variable declaration

            Thanks,
            This is good advice.

            Jesse

            Comment


              #7
              RE: Global variable declaration

              I'll note them well.
              I have forgotten to make it clear what a function is to do before,
              and spent some time reading the code till it made sense. So, I can relate

              Good Ideas.

              I have an Idea what is happening so I think I know why one variable is not being
              updated. (The OnTime event is starting over before the last OnTime event is finished, OOPS). I can Fix that.

              Thanks Again.

              Jesse

              Comment

              Working...
              X