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

Loosing Global Variables

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

    #16
    Re: Loosing Global Variables

    When programming in several other languages I have only ever had to dim global variables once.
    But I don’t have a problem Dim them again if it solves the problem.
    First of all none of my global variable are ever used as local variables so the program should never have a problem with the variables I use.
    Second I only seem to have this issue one out of 200 cases of running a script. So I would think that if I have a problem with these global variables then it would happen every time.
    Third I have now found that I have a random loss of a few local variables also (all variables are dim using the local form). I have about 25 temporary variables that are only used locally to store temporary information that is displayed on the form. I have a couple of times these variable produce an error of variable not found. (again 1 out of 200 cases)
    I said all this to say I think this issue is a symptom of a bigger issue:
    My environment is I have the program / database on a server. All computer that access the program are using run time alpha running pointing to the server and running off the server (no shadowed data bases)
    There has been a couple of times while the program is running that I get a message that the database can’t be found. \\TPSRV\SAMFolder\solutions\.dbf can’t be found. This error makes no sense considering the program is running and it obviously is still using the database . I have to exit the program and go back in and everything works fine. (same goes for the global and local missing variables) - I am beginning to think these issues are related in some way)
    Has anyone else see this issue? Can I trap for this error and resolve it in code?

    Comment


      #17
      Re: Loosing Global Variables

      Virginia, when we say a variable has "local" scope, we mean "local" to the script in which it is running. We do not mean "local to the machine", or "local to the form". Other scripts or calculated display variables running in the same form on the same machine can't see them.

      Comment


        #18
        Re: Loosing Global Variables

        Sounds like you are having server hiccups. If you are not running the program shadowed, why not install T/S. It would be many many times faster than your current approach.

        About 10 or so years ago, Selwyn pointed out that even though global variables do not, technically, have to be redimed in scripts, that using functions and methods without redimming them in the script would sometimes cause failure. Since then, I always redim global variables in scripts where I am going to thusly use them.
        Cole Custom Programming - Terrell, Texas
        972 524 8714
        [email protected]

        ____________________
        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

        Comment


          #19
          Re: Loosing Global Variables

          Can I trap for this error and resolve it in code?
          Not sure what you want to do to resolve the issue but you can trap the missing variable problem with

          variable_exists()
          There can be only one.

          Comment


            #20
            Re: Loosing Global Variables

            Tom, I do understand the local scope of the variable. And I do know that running another copy of the program has no effect on other copies (variable wise)
            However in a form I can use the ability to setup session variable and layout variable that can be used on that form for display purposes - and I can use those variable within the events that are used in the form.
            I know that once the form is closed - those variable are not available. However as long as that form is open and running I should be able to use the session/layout variables on the form and I should not get the message "variable not found" on any of the event nor should I see "error" on the screen where the variable should be.

            During my initial investigation I see this type of issue happened mostly on global variables - (but now I see the case where it is happening on a session/layout level on a single form) - so Now I am thinking it may be something to do with the network maybe it looses connection for a second ???? That is the only reason I am explaining the environment - not because I thing the individual programs running are crossing.

            Comment


              #21
              Re: Loosing Global Variables

              I really don't want to put a bandaid on this, I would like to figure out what the root cause is of the issue - I am hopping it's my code and not a network issue. But when I can't duplicate the problem I can only monitor and error log file (I record every error the program has) - it difficult to fix something you can't recreate.

              Comment


                #22
                Re: Loosing Global Variables

                When you run the same program on multiple workstations, and not shadowed, there is an e n o r m o u s amount of data that has to travel back and forth accross the network. That includes the forms you are using. I suspect that shadowing would help.
                Cole Custom Programming - Terrell, Texas
                972 524 8714
                [email protected]

                ____________________
                "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                Comment


                  #23
                  Re: Loosing Global Variables

                  FYI -- I just resolved that dbf not found issue - it was not a network issue.

                  As for Shadowing the Database - I had issues where the local copies would not refresh automatically even though I updated the version numbers correctly. However when I am not doing improvements daily to the program I will be switching it over to shadowed and I will deal with making sure the refresh is solid.

                  So I am back to dim all of the main scripts and functions with my global var - so I can release it and see if the issue goes away.
                  The session/layout form variables lost will have to be a different solution because I can't re dim them or the data is lost

                  Comment


                    #24
                    Re: Loosing Global Variables

                    Yes you can
                    the commands
                    dim xxx as c 'a local varible to the script only
                    dim shared yyy as c
                    dim global zzz ac c

                    DOES NOT change the current value of the variables
                    Cole Custom Programming - Terrell, Texas
                    972 524 8714
                    [email protected]

                    ____________________
                    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                    Comment


                      #25
                      Re: Loosing Global Variables

                      Sething else to consider although it should not be necessary.

                      If the "main" form is always open and the current_stocknum variable is visible on the form with the objectname current_stocknum you can reference the value in current_stocknum with

                      :main.current_stocknum.value

                      regardless of the variable scope.
                      There can be only one.

                      Comment


                        #26
                        Re: Loosing Global Variables

                        Hi Martin,

                        Originally posted by martinwcole View Post
                        About 10 or so years ago, Selwyn pointed out that even though global variables do not, technically, have to be redimed in scripts, that using functions and methods without redimming them in the script would sometimes cause failure. Since then, I always redim global variables in scripts where I am going to thusly use them.
                        Don't use the word REDIM, as that is significantly different from DIM'ing again in each script. If you do mean REDIM, that is wrong technique.

                        As for Selwyn's warning, it is refers to Alpha's internal use (as well as your own) use of DELETE of variables in code that just happen to have the same name as yours (and I've seen this occasionally at times in other people's code), and action scripts that create and delete lots of variables without proper dimensioning. Alpha has lot's of old code (and occasionally new code) that is not 100% DIMed properly, and that creates lots of potential problems. They also use a lot of global variables with their internal code that can cause potential conflicts, and the names are often not that unique.
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                          #27
                          Re: Loosing Global Variables

                          Tom:
                          Yes, this thread seems to go on and on and went beyond clinical analysis. I am not suggesting that it is or it is not a good practice to dim the variable each time you use it..I think I was grossly misunderstood there. I am saying, by definition, when you dim a variable global, it should last the entire session, period. If you want to wear belt and suspenders, so be it, but a global variable should remain alive the entire session.
                          If I had this problem, I would first:
                          1-Determine if the variable has actually been dimmed, and if so
                          2-Has it actually been lost. If it has, I'd call Selwyn, stat. But I do not know if this clinical diagnosis has or has not been done and I am now suffering from thread fatigue.

                          Comment


                            #28
                            Re: Loosing Global Variables

                            Thank's IRA - I never "redim" - but I have found it quite useful for dimming them in a script, as they are then avail when writing the code for that script, using them in functions, methods, etc.

                            Maybe 10 years ago, or so, I remember having a global variable dissappear - but I think it was some machine/network issue. I have never had it since.

                            I use a lot of general purpose global variables
                            bd, ed, ans (for answer), gpc1(general [purpose character), gpn1, gpl1. But I change their values - they are not constants. If I want a "Constant" I so define one. I am likely a bit old fashioned, but I always define globals in the autoexec.
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            [email protected]

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment


                              #29
                              Re: Loosing Global Variables

                              Stan,

                              Just actually read - "If you're the smartest person in the room, you're in the wrong room." I fully appreciate the thought behind it - but the statement, if followed, would eventually lead to everyone leaving the room, ostensibly forever in search of a room in which they were not the smartest. What a conundrum. Thanks for the laugh.

                              Comment


                                #30
                                Re: Loosing Global Variables

                                As long as I have been using alpha and we have had global variables, I never found it necessary to dim them again.
                                I thought I had made that statement in this thread, but guess not.
                                I generally dim them in autoexec on start of the application and they are alive 'til shutdown of the app. That I am sure of.
                                Dave Mason
                                [email protected]
                                Skype is dave.mason46

                                Comment

                                Working...
                                X