FIELD tag

Defines a field that the user selects as input for an analytic script.

The field must be part of the table defined in the preceding TABLE tag. The first FIELD tag must immediately follow a TABLE tag, and can be followed by additional FIELD tags entered on sequential lines.

Note

The TABLE and FIELD tags require that an Analytics table pre-exists in the storage location in order to be available to be selected. For more information, see DATA tag.

Use the TABLE and FIELD tags if you want to create variables that allow users to specify different tables or fields for use with the same analytic script. If the script is designed to always work with the same table and set of fields, with names that do not change, you can hardcode the table and field names into the script and avoid use of the TABLE and FIELD tags.

Syntax

//FIELD variable_name type label
  <description>

Parameters

Name Description
variable_name

The name of the variable that stores the input field name selected by the user. Use variable_name in the analytic script to reference the field.

Do not include any spaces in variable_name.

Do not use any of the following characters in variable_name. They are not supported:

` ~ ! @ # $ % ^ & * ( ) - + = { } [ ] | \ : ; ' " < > , . / ?
type

The types of fields that can be selected. Any type, or combination of types, from the following list can be selected:

  • C – character data
  • N – numeric data
  • D – date, datetime, or time subtype of datetime data
  • L – logical data

Any computed fields in a table can be selected regardless of the type specified.

label

In Robots, the interface label that users see when prompted to select the field. For example, Payment Date Field

description

optional

In Robots, descriptive text associated with the input field that users see. The description can be multiline, but it cannot skip lines.

The description can help the user select the correct field. For example, Select the column that contains the check payment date.

The description must be entered on the line below the associated FIELD tag.

Examples

Basic examples

Specifies a character field:

//FIELD v_last_name C Last Name Field

Specifies a character or numeric field:

//FIELD v_inv_num CN Invoice Number

Advanced Examples

TABLE with two accompanying FIELD tags

The following analytic header allows the user to specify two input fields from the v_table_payments table when the script runs:

COMMENT
//ANALYTIC test analytic
//TABLE v_table_payments Payments Table
  Select a table that lists payments and includes a check number column.
//FIELD v_check_num CN Check Number Field
//FIELD v_payment_date D Payment Date Field
  Select the column that contains the check payment date.
END

OPEN %v_table_payments%
EXTRACT FIELDS %v_check_num%, %v_payment_date% TO t_analyze