ActiveReports 12
Data Field Expressions
ActiveReports 12 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Section Report > Summary > Data Field Expressions

The DataFieldExpressions sample demonstrates the use of data field expressions for simple calculations within the same section of the unbound report using known Fields collection values. These data field expressions cannot be used with the built in summary functions of ActiveReports 12. 

Sample Location

Visual Basic.NET

<User Folder>\GrapeCity Samples\ActiveReports 12\Section Reports\Summary\DataFieldExpressions\VB.NET

C#

<User Folder>\GrapeCity Samples\ActiveReports 12\Section Reports\Summary\DataFieldExpressions\C#

Run-Time Features

When you run the sample, the DataFieldExpressionsReport appears in the Viewer control. The DataFieldExpressionsReport displays data, using the Fields collection from the OrderDetail class.

The report data under ExtendedPrice is calculated by the data field expression, specified in the DataField property of the txtExtendedPrice TextBox at the design time.

Project Details

StartForm

The Viewer control has its Dock property set to Fill. This ensures that the viewer resizes along with the form at run time. Right-click the form and select View Code to see the code used to run the report and display it in the viewer.

DataFieldExpressionsReport

The DataFieldExpressionsReport is an unbound report that uses the field values from the OrderDetail file for displaying the report data.

PageHeader section

This section contains one Label control with the note text and four labels with the names of the report data fields.

Detail section

This section contains four textboxes that use the Fields collection values to display the report data. 

The DataField property of the txtExtendedPrice textbox in the Detail section demonstrates how to format your data field expression.

OrderDetail

This file contains the class with data that is used in the fields of the report. When the report is run, the values of these fields are used to display data of the report.

The field values are bound to the fields in the DataInitilize event and the data is bound to the field values in the FetchData event of the DataFieldExpressionsReport.

See Also

How To