Reference to total values

Top  Previous  Next

For reference to the total value, use the GetTotalValue method of the Report object:

 

float sales = Report.GetTotalValue("TotalSales");

 

A list of totals can be seen in the "Data" window. From it, you can drag a total into the script, during this FastReport automatically creates a code for referring to the total.

 

Total value has got the FastReport.Variant type. It can be used directly in any expression, because the FastReport.Variant type is automatically converted to any type. For example:

 

float tax = Report.GetTotalValue("TotalSales") * 0.2f;

 

Reference to the total value can be done at that time when, it is being processed. Usually the total is "ready to use" at the moment of printing the band, on which it is located in the report.