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

Declare and refer to a global variable in Xbasic

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

    Declare and refer to a global variable in Xbasic

    OK, I'm sure this is a real dummy question for most of you, but I need to know how to declare a global variable and then refer to it using Xbasic.

    I'm pretty sure it's declared like this:
    DIM global SomeVar as c
    SomeVar = "xyz"

    so then if I want to use it as an argument in another grid, for example:
    args.add("SOME_VAR",SomeVar)

    does not work.
    I tried. e.global.SomeVar in the args, too... was just guessing.
    And I also tried global SomeVar in the args... does not work

    I've been using session variables but there are warnings in the new V11 documentation to limit the use of session variables, so I thought I'd teach myself to use global variables..... I know, I know... this should be basic knowledge, but maybe this will also help someone else too embarrassed to ask. :)
    Last edited by kingcarol; 01-13-2012, 11:09 AM.
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

    #2
    Re: Declare and refer to a global variable in Xbasic

    Just tried this:
    args.add("SOME_VAR",global_variables(SomeVar))
    and got error that there are 'Too many parameters'
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

    Comment


      #3
      Re: Declare and refer to a global variable in Xbasic

      I have searched Alphapedia and this forum and cannot seem to find how to get the value from a global variable. Upon further searching, I am wondering if I should be using a SHARED variable, but am stumped on how to refer to that one, also.
      Carol King
      Developer of Custom Homebuilders' Solutions (CHS)
      http://www.CHSBuilderSoftware.com

      Comment


        #4
        Re: Declare and refer to a global variable in Xbasic

        Carol - context is everything. Are you just declaring the variable for use in the local/current script? If so, there's no need for Global.

        Just simply:

        dim MyVar as C = "xyz"
        and
        args.add("SOME_VAR", MyVar)

        A Global variable is really for use on the desktop side to make sure the variable is persistent through the user's current instance of A5, though you can also use a global variable in a script -- including your grid's server-side events -- to pass values to a report, for instance. This is how you would show on the report a user's selection of Begin_Date and End_Date for instance.

        That help?
        -Steve
        sigpic

        Comment


          #5
          Re: Declare and refer to a global variable in Xbasic

          Thanks very much, Steve, but I know how to declare local variables... I use those all the time.
          I need to pass the value of some variables from one grid to another and have been using Session variables to do so.
          However, some of those are numerical variables and Alpha is warning that we should not be using Session variables much in V11, due to some coming changes, and most especially, not session variables for a numeric value. So.... I am trying to figure out what to use instead.
          Carol King
          Developer of Custom Homebuilders' Solutions (CHS)
          http://www.CHSBuilderSoftware.com

          Comment


            #6
            Re: Declare and refer to a global variable in Xbasic

            Global and shared variables only last as long as the current Request. To pass a variable from one page to another, you need to do so explicitly or use a session variable.

            You can still store a number in a session variable, but it is better to do so by storing it as a string value than a numeric value for future compatibility.

            Lenny Forziati
            Vice President, Internet Products and Technical Services
            Alpha Software Corporation

            Comment


              #7
              Re: Declare and refer to a global variable in Xbasic

              Thanks, Lenny. I guess I won't worry about it. Just thought that I should start learning what I ought to use instead of session variables since Alpha documentation indicates to limit use of session variables.
              Carol King
              Developer of Custom Homebuilders' Solutions (CHS)
              http://www.CHSBuilderSoftware.com

              Comment


                #8
                Re: Declare and refer to a global variable in Xbasic

                Session variables are a specific tool for a specific job. There is nothing wrong with using them where appropriate. However I have seen many developers blindly use them everywhere and and for just about everything, and that can have unintended consequences.

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                  #9
                  Re: Declare and refer to a global variable in Xbasic

                  I think I get it. I only use session variables when I am going to perform some action on another grid that won't have the fields I need to get the values. I don't use them for filtering the records in the 2nd grid, for example. In one I'm working on today, I open a grid that might have no records but is filtered to a certain job (using regular filter features to open grid from another grid, NOT session variable). To add a new record on the newly opened grid, I have to use Xbasic to insert the record for a number of reasons I won't go into here. In that Xbasic insert query, I need to know what job to use, but can't get it from a row since there are no rows. So I set a session variable for the job before opening the pop up modal window with the 2nd grid in it. I am being very careful to use pop up modal windows when I am going to refer to a session variable in the pop up. That way user has to close the window and if they open it again from another job, the session variable will be reset.
                  Carol King
                  Developer of Custom Homebuilders' Solutions (CHS)
                  http://www.CHSBuilderSoftware.com

                  Comment


                    #10
                    Re: Declare and refer to a global variable in Xbasic

                    How is it that you open the grid filtered based on some value (the job), but cannot reference that value? It does not sound like a situation that warrants a session variable to me.

                    Lenny Forziati
                    Vice President, Internet Products and Technical Services
                    Alpha Software Corporation

                    Comment


                      #11
                      Re: Declare and refer to a global variable in Xbasic

                      That makes me think I might be able to use CurrentGridFilter somehow in my Xbasic code. I'll try it.
                      Carol King
                      Developer of Custom Homebuilders' Solutions (CHS)
                      http://www.CHSBuilderSoftware.com

                      Comment

                      Working...
                      X