Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Running Total in XamDataGrid using XamCalculationManager
posted

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.:

Col1RunningTotalCol1
1 1
2 3
3 6
4 10
5 15
6 21
7 28
8 36

Sample project attached (see field MyCalc2).

Cheers,

Steve

ForumExample1a.zip
Parents
No Data
Reply
  • 4850
    Verified Answer
    Offline posted

    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:

    1. The test condition: in this case IsError([RunningTotal(-1)]). This is needed because the first record doesn't have anything above it.
    2. The value to return if the condition above is true, in this case [//StartingValue]. This can be any reference, formula or a constant value like 0.
    3. The value to return if the condition above is false, in this case [RunningTotal(-1)] + [Prop1].

    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:

    • FilteredSortedList - default
    • FullSortedList
    • FullUnsortedList

    I hope this helps.

Children