Getting a Pointer to Variables in a Different name-space

Description

Alpha Anywhere allows you to get a pointer to the variables in the following name-spaces:

  • Global variables

  • Session variables

  • Layout (form) variables

  • Local variables

  • Addin variables

Once you have a pointer to the variables in a name-space, you can read the values of variables in that name-space, you can change the values of variables, and you can create new variables. You can also use the pointer with the WITH ... END WITH construct. You can enumerate all of the variables in a name-space using the VARIABLES_ENUM( name-space_Pointer ) function. Alpha Anywhere returns a CR-LF delimited list.

To get a pointer to variables in this name-space:

Examples

  • Type this in the Interactive Window:

    g = global_variables() 
    ? g
    • Set " g " as a pointer to the global variables name-space. Alpha Anywhere will display all of the global variables

  • Type this in the Interactive Window:

    g.fullname = "Selwyn" 
    ? g.fullname
    • Defines a new global variable called fullname. Alpha Anywhere displays: Char1>= "Selwyn"

  • Type this in the Interactive Window:

    l = :customer.variables()
    ? l.find_what 
    l.find_what = "Boston"
    ? l
    • This assumes that you have opened a form called customer. Sets " l " as a pointer to the layout variables on the customer form. Displays the value in the find_what layout variable on the "customer" form. Sets the value of the find_what layout variable on the customer form. Displays all of the layout variables defined for the customer form.

  • Type this in the Interactive Window:

    s = session_variables( :customer.SessionHandle())
    • Sets "s" as a pointer to the session variables on the customer form.

  • Type this in the Interactive Window:

    variables_enum(s)
    • Displays all of session variables for the session in which the customer form is running.

  • Type this in the Interactive Window:

    s.newvar = "No"
    • Creates a new session variable called newvar.

The WITH ... END WITH construct is useful for manipulating several variables in the same name space. For example: Set the default name-space to global variables, then define several global variables.

with global_variables()
    Firstname = "Jonathan"
    Lastname = "Swift"
    Address = "2 Bigelow St."
    City = "Cambridge"
    State = "MA"
    Zip = "02139"
end with

Set the default name-space to local variables on the Customer form, then set the value of several local variables on the Customer form.

with :customer.variables()
    Start_date = {1/1/99}
    End_date = {1/31/99}
end with

See Also