Calculated Field Definition window: Fields

 


Name

Allows you to enter the name of the calculated field, up to 79 characters.

Result Type

Allows you to specify whether the expression in the Calculated Expression field or in the True Case and False Case fields will have a string, integer, currency, variable currency or date storage type.

If you select Integer as the result type, the calculated expression's result will actually be a long integer. If you wish to use the calculated field with a function in another calculated field, be sure to select a function that's compatible with long integer storage types.


If you select Currency as the result type, the calculated field's result will always be a 10-byte currency value.


Expression Type

Allows you to specify whether the calculated field you're creating will contain a calculated expression or a conditional expression.

A conditional expression is a boolean expression used to print one of two results in a calculated field. If the expression is true, the result of the expression entered in the True Case field will be printed; if the expression is false, the False Case result will be printed. A calculated expression displays the results of the expression itself in the calculated field.

Fields tab

Fields on the Fields tab allow you to select a field and add it to the calculated expression.

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. When you have chosen a field, click Add to add it to the expression. If there are no values for the selected resource type, the Field drop-down list will remain disabled.

The Resources drop-down list contains four system entries, followed by the name of each table associated with the current report. Each is described below:

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.

Calculated Fields

Fills the Field drop-down list with all calculated fields that can be referenced by the current calculated field.

RW Legends

Fills the Field drop-down list with one selection: Legend. Selecting this value allows you to use one of the values passed to the report through the legends clause of the run report or run report with name statements. Click the highlighted text below for a detailed procedure that describes how to use legends with arrays in calculated fields.

Globals

Fills the Field drop-down list with all of the fields declared as global variables in the current dictionary.

(Table Name)

Populates the Field drop-down list with the name of each field in the specified table. Only tables attached to the current report are listed.

Constants tab

Fields on the Constants tab allow you to define a constant and add it to the calculated expression.

Typically, constants are used in the True Case and False Case fields, or as a value against which fields are measured in the expression. This tab contains two fields: the Type drop-down list and the Constant field.

Type

Allows you to specify the storage type of the constant you're entering in the expression: Integer, Currency, String, Date or Time. The value you are allowed to enter in the Constant field depends upon the constant type selected. For example, if you select Integer as the constant type, you will be able to enter only numeric values in the Constant field.

Constant

Allows you to specify a constant, such as numbers or text, that will be entered in the condition, true case, false case or calculated expression.

When you have defined both the type and the constant, click Add to place the constant in the expression.

Functions tab

Fields on the Functions tab allow you to select a system-defined or user-defined function and add it to the calculated expression.

If System-Defined is selected, the Function drop-down list will appear, allowing you to choose a predefined function. If User-Defined is selected, two drop-down lists will appear, Core and Function. To select a user-defined function, you must first select the core with which the function is associated. You can then select the desired user-defined function from the Function drop-down list.

Function

Allows you to choose a function to insert into an expression. Each function should be entered in the expression before the field it will affect; for instance to use the STRIP function to remove trailing and leading blanks, enter STRIP, then the field from which you'll remove blanks. The field will automatically be placed in parentheses.

Refer to the following topics for more information:

 

Operators

Allows you to specify the relationships between fields and constants in expressions. Some operators will be dimmed and unavailable, depending on whether you're creating a calculated or conditional expression. Refer to the following topic for a complete description of each operator:

 

Calculated Expression

This field appears if you chose Calculated as the expression type. It allows you to enter the expression, such as a mathematical calculation or a concatenation of text fields, that will determine the value printed in the calculated field. You can't edit this field directly; rather, construct the expression using selections from the Fields, Constants and Functions tabs, and add the appropriate operators. Scroll arrows can be used to view all portions of a lengthy expression. To preview the expression, click on the field's prompt; the Calculated Expression window will appear. Click OK to return to the Calculated Field Definition window.

Conditional Expression

This field appears if you chose Conditional as the expression type. It allows you to enter the expression whose result determines whether the true case or the false case will be printed in the calculated field. You can't edit this field directly; rather, construct the expression using selections from the Fields, Constants and Functions tabs, and add the appropriate operators. Scroll arrows can be used to view all portions of a lengthy expression. To preview the expression, click on the field's prompt; the Calculated Expression window will appear. Click OK to return to the Calculated Field Definition window.

True Case/ False Case

These fields are available if you chose Conditional as the expression type. They allow you to enter the results you want printed in the calculated field if the expression in the Conditional Expression field evaluates to true or false for a given set of data. You can't edit these fields directly; rather, make entries using selections from the Fields, Constants and Functions tabs, and add the appropriate operators. Scroll arrows can be used to view all portions of lengthy expressions. To preview the expression, click on the field's prompt; the Calculated Expression window will appear. Click OK to return to the Calculated Field Definition window.

You must place values in both the True Case and False Case fields when you write conditional expressions.


Documentation Feedback