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 RESULTSET in the Field List and click the button. A calculated field displays a different icon than a real field () but can be used as the data source for an object in the Layout Area just like a real field. To edit a calculated field, select it and click the button. Click the to delete it.
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 at RESULTSET, 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:
Symbol Description Boolean A Boolean field capable of containing true or false (or yes or no) values. Byte A single byte. DateTime Used for date/time fields. Decimal A 128-bit type often used for monetary values. The range of values supported is ±7.9 x 10-28 to ±7.9 x 1028. Double A 64-bit number, with a range of ±5.0 x 10-324 to ±1.7 x 10308. Int16 A 2-byte integer value. The range is -32,768 to 32,767. Int32 A 4-byte integer value. The range is -2,147,483,648 to 2,147,483,647. Float A 32-bit number, with a range of -3.4 x 1038 to 3.4 x 1038. String Used for alphanumeric text. TimeSpan This type contains the span of time between two date/time values.