A calculated field is like a formula: it allows you to define your own calculation. However, unlike a formula, which is available for all reports, a calculated field belongs to just the report it's defined in.

To create a calculated field, select the Field List, right-click an existing field, and choose Add Calculated Field from the shortcut menu. The Property Grid shows the properties for the new calculated field. The properties are:

  • Name: the name of the calculated field. The name must start with a letter or underscore and can only contain letters, numbers, and underscores.

  • Data Member: the name of the data table in the data set for the report. You can normally leave this blank, but if the data set contains more than one data table, choose the desired one from the list.

  • Data Source: the name of the result set for the report. You can normally leave this blank, but if there's more than one data set, choose the desired one from the list.

  • Expression: the expression that calculates the value. For literal strings, use single quotes; for example, Country='Germany'. Click the "..." button to display the Expression Editor.

  • Field Type: the data type of the field. The choices are:

    BooleanA Boolean field capable of containing true or false (or yes or no) values.
    ByteA single byte.
    DateTimeUsed for date/time fields.
    DecimalA 128-bit type often used for monetary values. The range of values supported is ±7.9 x 10-28 to ±7.9 x 1028.
    DoubleA 64-bit number, with a range of ±5.0 x 10-324 to ±1.7 x 10308.
    Int16A 2-byte integer value. The range is -32,768 to 32,767.
    Int32A 4-byte integer value. The range is -2,147,483,648 to 2,147,483,647.
    FloatA 32-bit number, with a range of -3.4 x 1038 to 3.4 x 1038.
    StringUsed for alphanumeric text.
    TimeSpanThis type contains the span of time between two date/time values.

  • Scripts: displays the name of the script event handlers for each event raised by the object. In the case of calculated fields, there's only one event, Get a Value, raised when the report is running to get the value of the calculated field. To add an event handler for an event, choose it from the drop-down list.

See the Field List topic for other shortcut menu items related to calculated fields.

© Stonefield Software Inc., 2018 • Updated: 07/15/16
Comment or report problem with topic