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 Variables are not updating.

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

    Global Variables are not updating.

    I am attaching an alpha sport sample, in the main menu there is a button to GET CUSTOMER. It opnes form getcustomer.
    This form call for a CUSTOMERQUiCK form. There I can select a customer and apply the value of selected customer to 2 gloab variables.
    These globas are seen in the CUSTOMERQUiCK before using & return button is pressed.
    When returning to GET CUSTOMER form the globals vaiables in getcustomer form are not updated.
    It seems that they retain prior vaules.
    I have tried to make many changes in many events, but is not working.

    I can see that I can use the drop down in the customerid and make a selection. This application is in a touch screen and dropdown choices are not that practical, that is why I am using this aproach.

    Question : Why these globals are not updated in the getcustomer form?

    #2
    Re: Global Variables are not updating.

    Hi Mike,
    You are not setting the variables upon returning to the prior form.....how you have it currently all that you would need to do is to open the CustomerQuick form as Dialog--then the calling script will pause right after opening the CustomerQuick form and then resume once it is closed.
    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


      #3
      Re: Global Variables are not updating.

      Thanks for replying. The variables ( gCustomerID & gcustomerLN )needed are set before leaving customerquick.
      You can see as I displayed them, even before I leave the form.
      But once I returned to GETCUSTOMER, The globals are not updated. I have tried few different form sync and refresh in few events.
      As a test, I did create a button to re-fill the globals and it does.
      I will try your suggestion, But the question remains why the globals do not get updated at GETCUSTOMER under the same process of the button which started the request.

      Comment


        #4
        Re: Global Variables are not updating.

        Mike you neglected to specify "global" scope for the variables used in your CustomerQuick form. They are therefore local to the form. Changes to them in that form have no effect on the globals even though the globals have the same names.

        Confusing?

        Shouldn't be. Just remember that Alpha permits the same variable name to be used in different variable namespaces. You can have local and global variables that have the same names, because they're different variables. That's what's happening here.

        To see one approach to fixing this, take a look at my example, attached. I suggest you unzip the attachment and extract the files within to an empty folder to avoid overwriting your own work.

        Questions?

        Comment


          #5
          Re: Global Variables are not updating.

          Tom has the more exact reason behind it but it also appeared that you were trying to set the variables from the first form's calling script on the button....and this would set the variables for the first form as the script never stops.....unless you called the second form as dialog (modal). Once I did this the variables were set correctly.
          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: Global Variables are not updating.

            Mike_Data, I huddled with Mike_C offline and have come to believe that I may have misspoken. This was not a problem with the scoping of your variables as I originally thought. Instead, it was a timing issue with when the objects in your Get_Customer form were told to refresh their display. Text boxes bound to variables will not auto refresh when the underlying variable changes. Making the called form open as dialog pauses your calling form's script, so the refresh occurs after the new vars have been set in the called form. Sorry for the confusion my earlier response may have engendered.

            Comment


              #7
              Re: Global Variables are not updating.

              First I would like to apologize for not mentioning globals.
              For the past few days I have tried many different approaches to solve this process. I was confused and frustrated.
              Thanks to the comments of Mike and the sample from Tom, I understand a bit more.
              At some point I realize that the button getcustomer was running and not stopping. ( I did tried to use WAIT_UNTIL(), but did not do anything.
              I saw Tom sample in how to stop a button.
              In Tom sample I see that the globals get updated by the OBJECTREFRESH in customerquick form.
              One more detail:
              The last part of the button GETCUSTOMER was to make the fields customeID and customerLN in getcustomer form, to take the value of the corresponding globals.

              What event will trigger that addition upon returning from customerquick?
              (I tried a few with no results)

              Comment


                #8
                Re: Global Variables are not updating.

                Mike,
                What event will trigger that addition upon returning from customerquick
                What I said will do exactly that for you. Open the CustomerQuick form as dialog. Any script after the form opens that remains is paused until the CustomerQuick form closes...then it continues. IOW you have 3 actions scripts in your OnPush event for the button that opens CustomerQuick. The first one change to open the form as dialog. The other two scripts will not run until after the CustomerQuick form closes....that is one of the benefits of opening a form as dialog....the only possible con to this would be that you cannot navigate off the CustomerQuick form--it has to be closed prior to doing anything else.
                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


                  #9
                  Re: Global Variables are not updating.

                  Mike Data, here's one last point. When a form is opened "as dialog" it is not released from memory when the user closes it. The script that opened the form as dialog should include code that closes it, even though it's no longer visible on screen.

                  So, if you use Mike C's approach and open the CustomerQuick form "as dialog", you should include a final action in the script that opens that form. It should be inline xbasic and should read

                  Code:
                  if is_object("Customerquick") then
                      :CustomerQuick.close()
                  end if
                  If you neglect this final step the tables supporting the CustomerQuick form will remain open in memory.

                  Comment


                    #10
                    Re: Global Variables are not updating.

                    calling the form customerquick as a dialog form, works like a charm.
                    I was hoping not to have to use the form calling as a dialog form, I was afraid of loosing some of its functionality.

                    The fear was correct, As you recall the customerquick form is a duplicate of the customer form in alphasport.
                    The form has a multistate button. that feature is no longer available.

                    I can create 26 buttons with text as A,B, C... ands so on
                    and give the option to an script like a multistate script.
                    How do I change the value of mulstbtn1.text in:
                    filterExpression = "left("+searchby.text+", 1) = '" + mulstbtn1.text + "'"
                    without having to create 26 of these scripts?

                    Or is there another way to keep that button working in a dialog form?

                    I forgot, Thanks for all the advise.

                    Comment


                      #11
                      Re: Global Variables are not updating.

                      Mike,
                      I have not run across an issue doing as you are doing so I would have to create it from scratch (guess).

                      Regarding Tom's last bit of advice---definitely verify that the code he suggests using is present.....Action Scripting will normally place this additional closing code at the end of your scripts, but have noticed oddities over the years in which, if changed to dialog after other scripts are already in place, the additional closing code will many times either not be present or placed prior to the paused script. So for sure check.
                      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: Global Variables are not updating.

                        Mike_Data, my example did not force the called form to be opened as dialog. The button you use there to select the customer can update the fields on the calling form. You have lots of options here.

                        Comment


                          #13
                          Re: Global Variables are not updating.

                          I went back and call the customerquick form as a form and learn more about objectrefresh.
                          In order to be able to setup the objectrefresh, the other form must be open.
                          Every thing is working fine.
                          I got all my fields and variables checked.
                          Thanks to Tom and Mike for taking the time to help me.

                          Comment


                            #14
                            Re: Global Variables are not updating.

                            MikeData,

                            In order to be able to setup the objectrefresh, the other form must be open.
                            The action scripting code editor can "see" the objects in other forms only when those forms are open. If this is what you've discovered, relax. Working as designed.

                            Comment

                            Working...
                            X