# Calculated Field

Get started with FlexReport, a WinForms control, which is a fast-paced reporting engine that enables you to create, preview, export and print modern and dynamic reports for all your applications. See more in documentation here.

## Content



In order to create fields that do not use raw data, **Calculated** fields are the best option. Calculated fields contain expressions that are evaluated at run-time. They are used to generate those data values that are not stored in the data base.

## Add Predefined Calculated Field

Some predefined expressions are available in the dropdown of Calculated Fields. To add such fields, follow the steps below:

1.  Create a new FlexReport in FlexReportDesigner.
2.  From **Insert** tab, add two **Calculated** fields ![](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/images/calculatedfield-icon.png) - 'Date Created' and 'Page n of m', in the PageFooter section:<br />![Add calculated field in Designer](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/imagesext/insertcalculatedfield_option.png)
3.  Note the expressions in these calculated fields in the design area.<br /><br />![Calculated field](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/imagesext/insertcalculatedfield.png)
4.  Preview the report.<br /><br />![Preview field in the Designer](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/imagesext/calculatedfieldpreview.png)

## Add Custom Calculated Field

To define a Calculated field and add the field in the FlexReport Designer application:

1.  Create a new report.
2.  Bind the report with '**Orders Details**' Table.
3.  In Group Header, add a **Text** field 'Total' to display label for the total price.
4.  Go to **Data** tab, and right-click the Main data source and select **Add Calculated Field**. VBScript Editor appears.
5.  In the **VBScript Editor**, write the following expression:
    
    `Quantity*UnitPrice`
    
6.  Drop the above mentioned Calculated field as shown.
    
    ![Add TotalPrice field in the Designer.](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/imagesext/insertcalculatedfield_totalprice.png)
7.  Preview the report.<br /><br />![Preview report](https://cdn.mescius.io/document-site-files/images/96483bc4-d0db-40fa-a0e4-c5e6a4a56825/imagesext/calculatedfieldpreview_totalprice.png)