WebFOCUS Online Help > Managed Reporting Developer > Creating Reporting Objects > Virtual Fields (DEFINE Statements)
In this section: How to: |
A virtual field is a field whose value is not stored in the data source but can be calculated from the data that is there. A virtual field takes up no storage space; it is created only when a user accesses the Reporting Object that includes the virtual field.
You use the Define Tool to create a virtual field. Using this tool, you specify the virtual field's name, format, and the expression that defines the field. An expression enables you to combine fields, constants, predefined functions, and operators into an operation that produces a single value. For more information about defining fields, see the Creating Reports With Graphical Tools manual.
When you define a virtual field, you must specify a field format type, length, and appropriate display options.
In Developer Studio, right-click the Define folder and select Open in the Reporting Object window.
The following dialog box opens (this dialog looks slightly different in the browser).
For detailed information about field formats, see Field Formats.
You return to the Reporting Object window. The virtual field now appears in the field list when a user accesses this Reporting Object.
If you have finished working with the components of the Reporting Object, remember to click Done in the Reporting Object window to save the changes.
Note:
The Field Creator dialog box opens, displaying the expression for the selected field.
The Field Creator dialog box closes and you return to the Define Tool.
WebFOCUS saves the change and returns you to the Reporting Object window.
If you have finished working with the components of the Reporting Object, remember to click Done in the Reporting Object window to save the changes.
Note: Syntax and error checking are not performed on the commands you enter until the Reporting Object is executed.
In Developer Studio, right-click the Define folder and, in the Reporting Object window, select Open.
In the browser, the Define Tool dialog box opens and displays any existing virtual fields.
In Developer Studio, click the Defined Fields tab and select the virtual field you want to delete. Click the Delete button.
WebFOCUS deletes the virtual field and returns you to the Reporting Object window.
If you have finished working with the components of the Reporting Object, remember to click Done in the Reporting Object window to save the changes.
You must specify a field format for every virtual field you create. You assign a format based on the values that the virtual field will hold. The field format specifies the following information:
You can specify the format type, length, and appropriate display options in the Format input box in the Define Tool dialog box, or you can use the Change format dialog box to assist you in defining the field format as shown in the following image. The following procedure describes how to use this dialog box.
In this dialog box, you can select a format's attributes from list boxes instead of typing the required syntax.
The default length for the format type appears in the Length box.
Note: The Decimal box appears only for the Floating Point, Decimal, and Packed format types.
The Change format dialog box closes and you return to the Field Creator. The virtual field will have the field format you just specified.
Note: Syntax and error checking are not performed on the commands you enter until the Reporting Object is executed.
There are three types of field formats: alphanumeric, numeric, and date.
Note: If you define an alphanumeric DEFINE field to a constant value without enclosing the value within single quotation marks, WebFOCUS does not list the field in the Field List window for Report Assistant, Graph Assistant, and Advanced Graph Assistant.
Format |
Description |
---|---|
Integer (I) |
Integer format can consist of a maximum of 11 positions, counting the digits and an optional minus sign. Use this format for whole number values; the value cannot contain a decimal point. |
Floating Point (F) |
Floating Point format can consist of a maximum of 9 positions, counting the digits, a minus sign, and a decimal point. Use this format for whole numbers or fractional values. For larger numbers, use the Decimal or Packed formats. |
Decimal (D) and Packed (P) |
Decimal and Packed formats can consist of a maximum of 20 positions, counting the digits, minus sign, and a decimal point. Use this format for whole numbers or fractional values that are larger than the maximum value for a Floating Point value. |
For numeric formats, you can also specify how the field will appear in reports. Note that the characters added by these display options count toward the maximum number of positions a field can hold. For more information on numeric format options, see the Describing Data With WebFOCUS Language manual.
For Date formats, you can specify how the values that represent a date or date component are stored and displayed. For more information on date format options, see the Describing Data With WebFOCUS Language manual.
WebFOCUS |