When a field element is placed on a form, it may either be assigned to a database field defined for the record type on which the form is based or designated as a form variable. Variables are not stored in the Job Manager database. Instead, they are dynamically calculated based on the script each time the end-user adds or modifies the record in Job Manager. Variables may be referenced in the MetaScript of other field elements.
1. Select the field tool you want to use from the Tools Palette. Variables may be created for text entry fields, radio buttons, check boxes, and popups.
2. Move the cursor to the appropriate position, then click and drag to draw the field on the form. The Control Palette for the selected form is used to create the variable and specify other field options.
3. Click the Field expander button and select Variable. This will tell that the field being placed on the form is to be a calculated variable.
4. Name the variable in the Variable field.
Important! Variable names should be unique across the entire form to ensure proper execution of the MetaScript code.
5. Type a single MetaScript expression or multiple lines of code that should be used to calculate the value of the variable in the Calculate As/Default Value field. For details on using MetaScript with variables, please "Writing MetaScript for Database Fields and Variables" below. If you want the calculation to assume the value of a database field, click the Calculate As/Default Value MetaScript Editor button and select the appropriate database field from the MetaScript editor window. If you want to use an editable variable, select the appropriate datatype and type a default value in the Calculate As/Default Value control.
6. Specify the appropriate options for the field. The options available depend on the type of field used to create the variable.
7. Apply the appropriate attributes to the new variable field. For details on applying attributes, please refer to the "Working with Form Objects: Supported Actions" section.
8. Select Save Form from the Form menu to save the changes you have made to the form.