Working with FlexReport > Data Sources in FlexReport > Defining Calculated Fields |
Calculated fields contain expressions that are evaluated at runtime. 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 = rep.DataSources(0) ds.CalculatedFields.Add(New CalculatedField("Calc1", GetType(Integer), "CategoryID * 2"))
DataSource ds = rep.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. |