This example illustrates how to calculate field values dynamically based on a group aggregated value. The following syntax is used in this case: [collection][condition].Function([Field])
To calculate a group sum (for example), use the approach from the How to conditionally suppress summary footer cell painting by using formatting rules code example. Please note that you can use the '^' symbol in expressions to refer to a currently processed data record.
In this code example the following expressions were used:
calcUnitsInStockSum
[][[CategoryID] == [^.CategoryID]].Sum([UnitsInStock])
calcUnitsInStockPercentage
[UnitsInStock] / [calcUnitsInStockSum]
![]()
See also:
- How to calculate a weighted average function
Added By: Scott Gross at: 7/27/2016 10:29:43 AM Could you update this example to include a better description of the expression used for the calculated field? possibly adding it to the code here instead of having to download the sample and inspect the Designer.cs file?Added By: Olga (DevExpress Support) at: 7/27/2016 12:41:36 PM Hello Scott,
Thank you for your feedback! I agree that additional details may be useful in this description. I've updated it accordingly.
Please feel free to contact us in case of further difficulties.
To calculate a group sum (for example), use the approach from the How to conditionally suppress summary footer cell painting by using formatting rules code example. Please note that you can use the '^' symbol in expressions to refer to a currently processed data record.
In this code example the following expressions were used:
calcUnitsInStockSum
[][[CategoryID] == [^.CategoryID]].Sum([UnitsInStock])
calcUnitsInStockPercentage
[UnitsInStock] / [calcUnitsInStockSum]
See also:
- How to calculate a weighted average function
Question Comments
Added By: Scott Gross at: 7/27/2016 10:29:43 AM Could you update this example to include a better description of the expression used for the calculated field? possibly adding it to the code here instead of having to download the sample and inspect the Designer.cs file?Added By: Olga (DevExpress Support) at: 7/27/2016 12:41:36 PM Hello Scott,
Thank you for your feedback! I agree that additional details may be useful in this description. I've updated it accordingly.
Please feel free to contact us in case of further difficulties.