Assigning a value to a variable

To build an expression that assigns a value to a variable:

  1. If you have not yet created the variable, click New/Edit above the Variables list to display the Variables dialog box
  2. Click the button, enter a name for the variable, and choose a type from the Type drop-down menu. If you want the variable to be an array, check Array and enter the number of elements in the Elements field. Click OK.
    Note: Members of an array can be accessed by the variable name and position in the array list.
  3. Double-click the variable name in the Variables list to add the variable to the editing area. For example, if you want to retrieve the text from a Text Box object and place the text into a string variable named “UserName,” double-click UserName in the Variables list.
  4. To insert an equals sign, double-click the equals sign in the Operators area or manually enter an equals sign.
  5. Usually the value you assign to a variable comes from either an interactive object or some kind of calculation.
    • To assign a value from an interactive object, double-click the object name in the Objects list, and then double-click a function name in the Functions list. For example, to retrieve the contents of a Text Box object named MyTextBox, double-click MyTextBox in the Objects menu, and then double-click Text Object.GetText() in the Functions list.
    • To assign a value resulting from a calculation, use the appropriate functions from the Functions list and/or the appropriate operators from the Operators list. For example, to convert the value stored in the string variable UserName to all capital letters, add UserName.ToUpperCase() to the expression using the Objects list and the Functions list. Or, to calculate the combined length of two strings, add String1 + String2 to the editing area using the Variables list and the Operators list.
  6. To verify that you have a valid expression, click Validate. Note that this button merely checks your expression for syntax; a valid expression is not necessarily an expression that does what you want it to.
  7. Click OK.

Assigning a value to a variable