ActiveReports 11
Use Fields in Reports
ActiveReports 11 > ActiveReports User Guide > How To > Use Fields in Reports

Fields provide data to display on a report page. ActiveReports has two types of fields; a bound or database field and a calculated field.

To create a calculated field in a Section Report

In a section report, once you connect to a data source, bound fields automatically appear under the Fields > Bound node in the Report Explorer. However, you have to add calculated fields manually under the Fields > Calculated node. The following steps guide you through the process.

  1. In the Report Explorer, expand the Fields node.
  2. Right-click the Calculated node and select Add. This action creates an unbound field with a default name like field1.

  3. In the Report Explorer, with field1 selected, go to the Properties Window and set a value for the field in the Formula property. For e.g., for a calculated field Inventory, in the Formula field, enter the expression =UnitsInStock - ReorderLevel.



    You can change the name of the field in the Name property.
  4. Drag the field from the Calculated node onto the detail section of the report. This action creates a TextBox object, and sets its DataField property to the name of the calculated field.
Note: You can also add C# expressions in a Bound Field's DataField property to modify it. See Add Field Expressions for more information.

To create a calculated field in a Page Report/RDL Report

In a page report or a RDL report, all fields irrespective of their type appear under the corresponding DataSet node in the Report Explorer. To create a calculated field, you can add the new field in the DataSet dialog.

The following steps guide you through the process.

Note: These steps assume that you have added a DataSet in your report. See Add a Dataset for further information.
  1. In the Report Explorer, right-click the data set node and select Edit.
  2. In the DataSet dialog that appears, go to the Fields page and click the Add (+) button to add an empty field to the list.

  3. Under Name, enter the name of the field. By default it appears as Field1.
  4. Under Value, click the dropdown arrow and select <Expression...>, to open the Expression Editor dialog.
  5. In the Expression Editor dialog, create an expression you want to use as the value for the calculated field. For e.g., for a calculated field Cost, in the Formula field, enter the expression =[Quantity]*[Price]. See Expressions for further information.
  6. Click OK to close the Expression Editor and then the DataSet dialogs.
  7. From the Report Explorer, drag the calculated field from that now appears as a field under the DataSet node onto the design surface. This action creates a TextBox object, and sets its Value property to the name of the calculated field expression.
See Also