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

Help - Looping through namespace (global) variables...

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

  • Help - Looping through namespace (global) variables...

    As a learning project, am working with variables & scope.
    Can anyone tell me what is wrong with this function?
    (I assume problem is in red text area, but thus far have been unable to fix)

    FUNCTION ShowGlobalVars AS C ( )

    dim pGlobalVars as p = global_variables()
    dim cGlobalValues as c
    cGlobalValues = ""

    for each foo in pGlobalVars
    cGlobalValues = cGlobalValues + " " + *GlobalVars.value
    next


    ShowGlobalVars = cGlobalValues
    END FUNCTION

    *Amongst many other small mods, I tried substituting foo for GlobalVars here.

    I am trying to dislpay all the global variables on a forms field using the "Set 'value' property of field" action script.
    (and trying to specify the function as the expression)

    The initial creation of the function, saves without any problem. But upon attaching the function to a buttons on_push event, I run into a problem, and Alpha won't let me finish.

    When I try to close the parentheses on the function I immediately get an error and the action script won't save. The debugger opens and an error is immediately displayed. (Before I even save or run the form.)

    Here is the error:
    Property not found (& debugger stops @ the "next" statement in the code.)

    After exiting the debugger, I receive a second warning that the expression does not evaluate to a character value.
    I can't tell if the error is due to improper use of the for statement, improper reference to the global variable pointer, or the possibility of the global variables not being instantantiated during action script building. (since the form is only being created)

    Any help would be appreciated.
    Last edited by SNusa; 02-19-2009, 05:40 PM. Reason: clarification
    Robert T. ~ "I enjoy manipulating data... just not my data."
    It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
    RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

  • #2
    Re: Help - Looping through namespace (global) variables...

    You can get a character list of global_variables with

    GlobalValues = strtran_multi(PROPERTY_TO_STRING(global_variables()),"<"+crlf()+">","")
    ? globalvalues
    = showglobalvars=
    test="ABC"

    Note that it also returns the names of user defined functions.

    Just found another way....

    Code:
    ? user_variables_enum(global_variables() )
    = test
    Last edited by Stan Mathews; 02-19-2009, 06:10 PM.
    There can be only one.

    Comment


    • #3
      Re: Help - Looping through namespace (global) variables...

      The problem with your function is that the

      for each ..... next control structure requires a CR-LF delimited list, an array, or a collection.. You were feeding it a pointer variable.

      Code:
      FUNCTION showglobalvars AS C ( )
      dim pGlobalVars as p = global_variables()
      dim cGlobalValues as c
      cGlobalValues = ""
      cGlobalValues = properties_enum(pGlobalVars)
      ShowGlobalVars = cGlobalValues
      END FUNCTION
      There can be only one.

      Comment


      • #4
        Re: Help - Looping through namespace (global) variables...

        Originally posted by SNusa View Post
        I can't tell if the error is due to improper use of the for statement, improper reference to the global variable pointer, or the possibility of the global variables not being instantantiated during action script building.
        The whole darn thing is improper! but I don't fault you, it's a subtle difference.
        Those variables are POINTERS.... even though they are spitted out by alpha as a list, they are not. They POINT to the variables, i.e. for instance when you type ?global_variable() in your IW, you are asking alpha to go and find what global variables are out there and what are their values.
        Your function is attempting to process a list:
        dim pGlobalVars as p = global_variables()
        dim cGlobalValues as c
        cGlobalValues = ""
        for each foo in pGlobalVars 'No way! in order to make this work, you need to take the "list" presented by alpha and make alpha understand that you want to reference the variables. In other words, you need to use something like eval()
        cGlobalValues = cGlobalValues + " " + *GlobalVars.value 'this is immaterial, but if cGlobalValues="", then this part:cGlobalValues + " " + will add up to blank.
        GlobalVars.value you can't use .value here. ".value" is a property of an object on a form, not a property of a variable.

        ShowGlobalVars = cGlobalValues
        END FUNCTION
        I am trying to dislpay all the global variables on a forms field using the "Set 'value' property of field" action script.
        I am not sure what do you mean?

        Comment


        • #5
          Re: Help - Looping through namespace (global) variables...

          Thanks everyone.
          I have learned much via this thread - gained much insight.
          Had it not been for the quirks in the a5 gui, I never would have asked.
          In retrospect, I'm glad I did.
          Robert T. ~ "I enjoy manipulating data... just not my data."
          It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
          RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

          Comment


          • #6
            Re: Help - Looping through namespace (global) variables...

            UPDATE:

            Much relevant information re" FOR EACH constructs, lists and ENUM methods found here: http://msgboard.alphasoftware.com/al...ble-quot/page2
            Robert T. ~ "I enjoy manipulating data... just not my data."
            It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
            RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

            Comment

            Working...
            X