ActiveReports 13
ActiveReports 13 > ActiveReports User Guide > Samples and Walkthroughs > Samples > API > Section Reports > Summary

This sample shows how to use calculated fields and data field expressions for simple calculations in a report. 

Sample Location

Visual Basic.NET

<User Folder>\Documents\GrapeCity Samples\ActiveReports 13\API\Section\Summary\VB.NET


<User Folder>\Documents\GrapeCity Samples\ActiveReports 13\API\Section\Summary\C#


When you run this sample, The Viewer control with the Select Report drop-down list is displayed. There, you can select one of the two reports - OrdersReport or DataFieldExpressionsReport, and click the Load Report button to display the report in the Viewer.

The OrdersReport shows how to use calculated fields, where the field values are calculated in code. A custom field is added to the Fields collection in the DataInitialize event and the field value is calculated in the FetchData event. 

The DataFieldExpressionsReport 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 13.

Note: To run this sample, you must have access to the Nwind.mdb. A copy is located at [User Documents folder]\GrapeCity Samples\ActiveReports 13\Data\NWIND.mdb. If you are unable to access the data files in the sample, create the Data folder and place all the data files to this folder, or change the reference path to the data files within the folder according to your environment.

The sample consists of the StartForm and two reports - OrdersReport and DataFieldExpressionsReport.