Creating Virtual Fields (DEFINE Statements) in Reporting Objects


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 name and 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. When you define a virtual field, you must specify a field format type, length, and appropriate display options.

For more information about defining fields, see Data Tab in the WebFOCUS InfoAssist User's Manual.

Procedure: How to Create a Virtual Field

  1. Right-click the Defines component and select New, or select the Define component and click New on the ribbon.

    The Define tool dialog box opens, as shown in the following image.

    The Define tool

  2. Create a virtual field using the Define tool.

    For more information about the Define tool, see Data Tab in the WebFOCUS InfoAssist User’s Manual.

  3. Click OK to save the virtual field and return to the Reporting Object tool.

    The virtual field now appears in the field list when a user accesses this Reporting Object.

Note:

  • The field list shown in the Define tool is not updated to display new virtual fields until you exit from the Define tool and reopen it. If you are creating a virtual field (DEFINE statement) that uses a previously created virtual field in the expression, you must save the first virtual field before creating the second one.

    To save the first virtual field, exit from the Define tool by clicking OK. Reopen the Define tool to create the second field. Alternatively, you can type the name of the first virtual field in the expression instead of selecting it from the field list. In this case, you do not need to exit and reopen the Define tool.

  • Since every procedure creates a new session on the Reporting Server when it is run, the duration of your connection is always limited to a single procedure. Therefore, any DEFINE statements issued at the beginning of a procedure are in effect only for those report requests that are called in the same procedure.

Procedure: How to Edit a Virtual Field

Existing virtual fields appear under the Defines node, as shown in the following image.

Define

  1. Right-click the virtual field that you want to edit and select Open, or select the virtual field and click Open on the ribbon.

    The Define tool dialog box opens, displaying the selected field.

  2. Make changes to the field name, expression, or format, and click OK to return to the Reporting Object tool.

Procedure: How to View or Edit a Virtual Field in the Text Editor

  1. Right-click the virtual field that you want to view or edit as text and select Edit, or select the virtual field and click Edit on the ribbon.
  2. Make changes to the field name, expression, or format, and click OK to return to the Reporting Object tool.

Procedure: How to Delete a Virtual Field

  1. Right-click the virtual field that you want to delete and select Delete, or select the virtual field and click Delete on the ribbon.
  2. To delete all virtual fields at once, right-click the Defines component and select Delete All, or select the component and click Delete All on the ribbon.