Manage form variables

Use the following procedures to create, modify and delete form variables.

Create a form variable

  1. On the form modeling bar, click Form variables and click New.

    The New form variable dialog box is displayed.

  2. Enter a unique Name for the variable, such as CustomerName.
    If a form variable has the same name as a form control, the control name takes precedence.
  3. On the Type list, select the type of variable, such as Decimal. (Default: String)

    See the form variable types supported by TotalAgility.

  4. Select, enter or define a Value for the variable. For example, for the Array, define the number of columns.

    To provide a dynamic value at runtime, leave the Value empty.

  5. Do either of the following:
    • To add one variable at a time, click Add and close.

      The New form variable dialog box is closed and the variable is listed under Form variables.

    • To quickly add as many variables as needed without navigating away from the New form variable dialog box, click Add another.

      The current variable is added and the New form variable dialog box remains open with clear screen to add another variable. All the variables are listed on the Form variables page.

  6. Save the form.

Create a Data object variable

You can create a data object variable based on a data model (local or global) to use it in forms.

Once created, a data object variable can be used in the same manner as a string; however, the string value needs to be a JSON string. You can either use the entire variable or drill-down and use data model fields.

When debugging a form that is using a data object variable, the value is displayed as text and can be edited like a string value.

You cannot delete a data object variable if it is in use within the form.

  1. In the New form variable dialog box, enter a unique Name for the variable.
    By default, the name of the variable becomes the ID of the variable; however, you can change the ID if needed.
  2. On the Type list, select Data object. (Default: String)
  3. On the Value list, select a data model (global or local) or a field from a data model.

    For more information on how to use fields within a data object variable, see Access fields available within a data object variable.

  4. Click Add.

    The variable appears on the Form variables list page.

  5. Click Save.

Create a Date variable

You can set the Date variable value in a form either by selecting the required date and time using the calender picker or by clicking fx and using the @Today macro to get the current date or past/future date. For example, to set the date as 5 days from the current date, set the value as @Today+5.

At runtime, when the form loads, the value of the variable is set to the current date, or current date + (plus) or - (minus) the number of days specified (if any).

To create a date variable:

  1. In the New form variable dialog box, enter a unique Name for the variable.
  2. On the Type list, select Date. (Default: String)
  3. For Value, do either of the following:
    • Click the Calendar picker and select the required date and time.

    • Click fx.

      By default, @Today macro appears in the Value box. Use @Today macro to get the current date, or a past/future date by adding or subtracting the number of days. For example, specify the value as @Today+5. At runtime, the value of the Date variable is set to the current date + (plus) or - (minus) the number of days specified (if any).

  4. Click Add.

    The date variable appears on the Form variables page.

Modify a form variable

You can only change the value of a variable, but cannot change its name and type.

  1. On the list of form variables, click the variable to modify.
    The Edit form variable dialog box appears.
  2. Make changes as needed.
  3. Click Update.
  4. To delete a form variable, on the context menu of the variable to delete, click Delete.

    On confirmation, the variable is deleted.

Delete a form variable

To delete a form variable, on the context menu of the variable to delete, click Delete.

On confirmation, the variable is deleted.