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

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

    global variables

    I have read all the books, and have searched for this information, but I have forgotten it if I saw it and hope someone can briefly answer this question about variables.

    It looks like a global variable can be defined in the table structure, and in each form structure, and also in xbasic scripts, and action scripts. I am confused where exactly to define variables for different situations. I have experimented and eventually things work, but I'm generally not sure how I got it to work. For instance, a button on one form opens a second form, and then a button on that second form closes the second form and focus returns to the first form. Information is transferred from the first to the second form, then back to the first form. Where and how do I declare/define the global variable to do this. It seems I have to end up defining it in all places before this process works, but I'm sure that's not necessary.
    Thanks, Mark

    #2
    RE: global variables

    Mark,

    If I understand what you want to do, you're making it much more difficult than it needs to be.

    "For instance, a button on one form opens a second form, and then a button on that second form closes the second form and focus returns to the first form."

    This can easily be done with action scripting; perhaps you are?

    "Information is transferred from the first to the second form, then back to the first form."

    I'm confused. can you be msore explicit in your description on what info is transfered to the 2nd form? Does the same info go back to the 1st form? Or, is it info which you entered on form 2 that goes back to form 1? If the latter, why?

    kenn
    TYVM :) kenn

    Knowing what you can achieve will not become reality until you imagine and explore.

    Comment


      #3
      RE: global variables

      Ken,
      I have six fields, some of which may be empty. If one is empty, I want to manually enter a time of day (hh:mm) into the field, but I want to actually enter it on another form and include special directions, and have the user enter the hh in one field, and mm in another field, then combine them.

      I did get this to work, but probably in a round about way. When clicking on a field, the second form is opened by a script in the OnArrive event. I need to tell the second form that it was opened from that particular field, so the time data that is entered in that second form will be placed back into the proper field on the first form. I gave a variable a value equal to the name of the field (to help keep everything straight).

      By testing the value in the variable which is set to the name of each field, I can use conditional statements in the second form to place the data into the proper field on the first form. There is probably a more efficient way. I thought about using a variable in a statement such as topparent:variable.value=(calculated expression) where the variable represents the field in question, but could not get that to work. Can a variable be incorporated somehow into the syntax referring to the value property of a field? I am eager to learn the right way to do this.

      Thanks for the help,
      Mark

      Comment


        #4
        RE: global variables

        Mark

        Essentially, global variables can be declared almost anywhere. The only requirement is that they be declared before they are used. If they are only used by a button action, they can be declared in the button code. If they may be used in many locations, then they can be declared at startup in an autoexec script. If they are needed for a table field rule for example, they can be declared in the table structure. The only difference is when the variable exists for the first time. After it is declared, it exists until it is deleted or the database closes.

        Typically, I declare all globals on startup with a script that runs from an autoexec. The only exception is a global needed by a table for a field rule (which I use rarely). Then I also declare it in the table structure. This causes the global to be declared as soon as the table opens.

        From the description of your process, variables may be a good way to transfer data. However, you may be able to uses shared variables instead of globals. These only exist until the current session is closed. Or, you could just use globals and delete them when the process is complete. In the end, the real question is - does it work? That is the main criteria.

        Jerry

        Comment


          #5
          RE: global variables

          Mark,

          I vaguely understand what you're trying to do so I don't know if my next suggestion will work but is worth checking out.

          Have a look at the lookupc function in the A5 Expressions Functions Reference book. I've used this successfully to copy data from a field in tbl_2 to like field in tbl_1. This is done in the tables field rules of tbl_1.

          Another thought, are you sure you have the best set design for this?

          Is it possible for you to zip the tables and sets (only those involved with the form) and attach them to your reply so we can take a look at it and get a better idea what you're trying to accomplish?

          kenn
          TYVM :) kenn

          Knowing what you can achieve will not become reality until you imagine and explore.

          Comment


            #6
            RE: global variables

            declaring global variables more than once, which I often see done in scripts, was originally a bit confusing to me.

            I thought to myself, well I declared the global variable in the autoexec script - oh my, what will happen if i declare it again? Will doing so destroy the data that is already in the variable? Why does this guy keep saying "dim global myvar as c" everywhere he goes?

            In many languages, all scripts have to be "explicit" - that is, you cannot reference anything that was not declared in the script. So, as a matter of habit and style, many programmers continue to do so, although it is not necessary in Alpha. Since the languauge I came from did not require a global variable to be declared more than once, I never acquired the habit.

            Once you declare a global variable, you can freely reference it anywhere, and its value remains until you change it. For example, I use "ans" as a global variable to get responses from a ui_message_box or ui_get_radio and use the value elsewhere, like in a report or query.

            And in all applications, I use globels to pass values around, like cid-"customerid, ponum-"purchase order number, etc.


            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

            Working...
            X