ComponentOne FlexReport for WinForms
Defining Calculated Fields
Working with FlexReport > Data Sources in FlexReport > Defining Calculated Fields

Calculated fields contain expressions that are evaluated at run-time. These can be added to a data source using DataSource.CalculatedFields.Add method.

The code to add a calculated field, say 'Calc1' that calculates 'CategoryID * 2' , of the Integer type, is as follows:

Dim ds As DataSource = C1FlexReport1.DataSources(0)
ds.CalculatedFields.Add(New CalculatedField("Calc1", GetType(Integer), "CategoryID * 2"))
DataSource ds = c1FlexReport1.DataSources[0];
ds.CalculatedFields.Add(new CalculatedField("Calc1", typeof(int), "CategoryID * 2"));

Note that if there are more than one Calculated field, they must have unique names.