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



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

Variable declaration?

  • Filter
  • Time
  • Show
Clear All
new posts

    Variable declaration?

    Okay, so I have a button on a form that starts off a data collection process. One of the first things that happens is that several SHARED variables are DIMmed and then assigned values (mostly logical False, but a few are blank character vars).

    Three or four forms are called. Each one, in its INIT event, DIMs those shared variables again so that they can be used by the form. (I collect data to variables rather than directly enter data into a table in order to check the data and for other manipulation prior to placing the information into the record.)

    My question is this: I originally used fields copied from a form that IS directly accessing/showing the data, and converted the source from a table/field to a variable. But it seems that the form doesn't see the variables that I DIMmed in the INIT event.

    I have to create a "new" variable rather than assign an existing one to the data object. Am I doing something wrong?

    Re: Variable declaration?

    DIMmed in the INIT event

    You may have a timing issue. Try dimming them in the onactivate event. (Follows the oninit timewise)
    There can be only one.


      Re: Variable declaration?

      Thanks, Stan. I'll give that a go first thing tomorrow -- leaving the office in less than a minute!


        Re: Variable declaration?

        Just got in and will be on this in a few minutes, but one question occurred to me. Does it matter if I choose "Create using Xbasic" or "Create using Action Scripting" as to whether or not the DIMmed variables will be visible for me to use when setting the properties of an object?


          Re: Variable declaration?

          There can be only one.


            Re: Variable declaration?

            Well, it didn't work.

            Here's what I have in the OnActivate event for the form:
            'Date Created: 05-May-2010 11:45:08 AM
            'Last Updated: 05-May-2010 12:15:59 PM
            'Created By : Kevin
            'Updated By : Kevin
            DIM SHARED varL_Schl_acc as L
            DIM SHARED varL_HF_app as L
            DIM SHARED varL_HF_agr as L
            DIM SHARED varL_drv_pol as L
            DIM SHARED varL_BG_chk_auth as L
            DIM SHARED varL_BG_chk_conf as L
            DIM SHARED varL_HF_int as L
            DIM SHARED varL_HF_scrn as L
            DIM SHARED varL_HF_refs as L
            DIM SHARED varL_welcm_brch as L
            DIM SHARED varL_HF_pre_o as L
            DIM SHARED varL_HF_post_o as L
            DIM SHARED varA_pcmt_cmnt as C

            varL_Schl_acc = .F.
            varL_HF_app = .F.
            varL_HF_agr = .F.
            varL_drv_pol = .F.
            varL_BG_chk_auth = .F.
            varL_BG_chk_conf = .F.
            varL_HF_int = .F.
            varL_HF_scrn = .F.
            varL_HF_refs = .F.
            varL_welcm_brch = .F.
            varL_HF_pre_o = .F.
            varL_HF_post_o = .F.
            varA_pcmt_cmnt = ""

            These are also DIMmed in the OnPush event of the button that, among other things, calls the form in question.

            I want to use these variables in the Field property of several check boxes on the form. However, when I go to choose them they are not listed as available variables. I have to enter them again as new variables. I know I'm doing something wrong, I just can't figure out what that something is.


              Re: Variable declaration?

              Not sure exactly what you are trying to do. "Shared" has to do with available to other scripts on the same form, not shared between forms.

              You may need to use global variables or get a session handle to which to refer.
              There can be only one.


                Re: Variable declaration?

                I'll make 'em global and see what happens.


                  Re: Variable declaration?

                  Then you may also want to change to the autoexec script for the form or the oninit event for your startup form. That way they will be available in the drag drop list when you design other forms.

                  You might also check this thread in the code archive. Dusty but serviceable.
                  There can be only one.


                    Re: Variable declaration?

                    Actually, changing the autoexec script for the app was the first thing I did.

                    And, as you already knew, it worked perfectly.

                    I guess I need to do some more studying up on scope, as the fact that "Shared" only referring to scripts on the same form (rather than forms called by other forms) was not clear at all from what I've read so far. That one statement from you was far more illuminating than any other text I've read. Thank you!

                    I'll read the thread you linked to ASAP.


                      Re: Variable declaration?

                      I may not have expressed that correctly. See the screenshot for the explanation visible when defining variables for a form and using the Understanding Variable Scope link.

                      May be a question of understanding what a session is.
                      There can be only one.


                        Re: Variable declaration?

                        Originally posted by Stan Mathews View Post
                        May be a question of understanding what a session is.
                        I think that is the core issue, right there.


                          Re: Variable declaration?

                          Here is an analogy I have used and just wrote down....maybe it will help in understanding....
                          Variable Scope:

                          An Analogy....been told by various individuals and modified for my own explanation

                          to people.

                          Think of a business in which the building is a warehouse that has offices inside it.

                          3 different cases:

                          1. The CEO, while IN his office with the door CLOSED, tells his secretary to do

                          The only people privy to this conversation are the CEO and the secretary. (Local


                          2. The CEO, while IN his office with the door OPEN, tells his secretary to do

                          The people privy to this conversation now are the CEO, the secretary, and anyone

                          right outside his office. (Shared variable)

                          3. The CEO, while IN his office with the door open AND the building wide INTERCOM

                          turned on, tells his secretary to do something.
                          The people privy to this conversation now are the CEO, the secretary,anyone right

                          outside his office, And everyone inside the entire warehouse building. (Global


                          The information that is told is the variable.
                          The CEO's office is a script/function.
                          The other people right outside the office are other open forms.
                          The entire warehouse is the entire application.
                          The scope is who can hear the information.
                          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


                            Re: Variable declaration?

                            Okay . . . so, if these other forms are already open (for instance, initialized but not activated when the primary form opens, and then activated as necessary when the button in question is pushed) then they could see the shared vars?


                              Re: Variable declaration?

                              My understanding is if a variable is dimensioned shared from a form.....any other form that is open can see the variable---they don't have to be opened when the variable is dimmed, just open while the form that dimmed the variable is. Hey, try it and see....takes but a few seconds to test. If it cannot see it for some reason, try global and if it works, your work is done....

                              It has been stated that there is no real overhead with having ALL variables global....but there are other reasons not to such as then a variable will maintain its value when perhaps it is not wanted or accounted for, causing the same named variable being used elsewhere to have a value not wanted/intended.....making certain EVERY variable has a different name would eliminate this problem, but sometimes that is hard to accomplish.
                              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