The Fields tab contains two drop-down lists: Resources and Field. Once a resource is selected, the Field drop-down list is enabled, displaying all available choices of the selected resource type. If there are no values for the selected resource type, the Field drop-down list will remain disabled.
The Resources drop-down list always begins with four system entries: Report Fields, Calculated Fields, RW Legends, and Globals. These are followed by the name of each table associated with the current report. If a table name is selected, each field in that table will be listed in the Field drop-down list. The following describes each system entry, and what appears in the Field drop-down list if that entry is selected.
Report Fields fills the Field drop-down list with all fields on the report that have modified display types (fields for which the Report Field Options window has been used to change the field’s display type from Data to some other type, such as Count). The display type, or an abbreviation of the type, is listed first, followed by the name of the field to which it was applied. Use the Report Field Options window to change a field’s display type.
Calculated Fields fills the Field drop-down list with all calculated fields the current calculated field can reference. Under special circumstances, dependencies between calculated fields can that prevent them from being used by the current calculated field. If a calculated field can’t be used, it won’t be displayed in the list.
RW Legends fills the Field drop-down list with one selection: Legend. Selecting this value allows you to use one of the legend values passed into the report by the application. When you click Add, a dialog box will appear, prompting you to enter an index value indicating which legend value to use. The legend will be added to the expression you’re creating.
A legend is passed into the calculated field as a string. If you need the legend value to have some other storage type, you will need to use one of the system-defined functions to convert the legend value. System-defined functions are described in System-defined functions.
Often, legends are used in a calculated field to specify the array index of an array field. The following procedure describes how to use a legend to specify the array index in a calculated field.
Select an array field to add to the expression and click Add. A dialog box will appear, prompting you to enter the array index. Enter any number, then click OK.
Highlight the newly-entered index number in the expression, and then click Remove.
Click the Functions tab, and select the STR_LNG system-defined function. Click Add. This function will convert the legend (a string value) value into a long integer so it can be used as the array index.
Click the Fields tab. Select RW Legends from the Resources drop-down list, and Legend from the Field drop-down list. Click Add; you will be prompted to enter the array index. Enter the number corresponding to the position of the desired legend value. For example, if four legend values are passed to the report, enter an index of 1 to specify the first legend, 2 to specify the second, and so on.
The value you passed to the first legend will specify which array element value to display. If the value 1 is passed to the first legend, the first quarter’s bonus value is displayed. If the value 2 is passed to the legend, the second quarter’s value is displayed, and so on.
Globals populates the Field drop-down list with all of the fields declared as global variables in the current dictionary.