Hi,
Is there a way of doing running totals within the XamCalculationManager/XamDataGrid setup?
I'm open to any alternate strategies that anyone can suggest! :-)
e.g.:
Sample project attached (see field MyCalc2).
Cheers,
Steve
This topic describes the formula syntax in detail:
http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/InfragisticsWPF4.Calculations.XamCalculationManager.v14.2~Infragistics.Calculations.Engine.ICalculationFormula~FormulaString.html
Note: you might also want to check out the xamFormulaEditor. The dialog it pops up lists all of the built in functions or you could call the xamCalculationManager's GetAllFunctions() method. You can also register custom functions via the RegisterUserDefinedFunction or RegisterUserDefinedFunctionLibrary methods.
Thanks Joe! Great help.
Is there somewhere this is well documented? I would have struggled to find all of this myself and I'm sure I'm missing out on some really rich functionality.
Hi Steve,
Yes you can implement running totals easily since the formula supports relative references. Here is an example of a running total for 'Prop1':
Formula="IF( IsError( [RunningTotal(-1)]), [//StartingValue], [RunningTotal(-1)] + [Prop1])"
Note: that the 'IF' function takes 3 parameters:
Also be aware that there is a property exposed off FieldLayoutSettings named CalculationScope that governs which record references are returned when using these relative indices. The possible values are:
I hope this helps.