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
60
Wingrid summary field calculation based off other summary fields
posted

 I have a grid with several columns, the last of which is a calculated value based off the other columns.  At the bottom of the base data columns I have a summary row summing the rows for each column.  This all works with no problems.  My problem is getting a calculated value for the last column based off the summaries of the other columns.

A B C D E F

1 1 1 1 1 1 x

2 2 2 2 2 2 x

3 3 3 3 3 3 x

-------------------

t t t t t t  ?

The values x in each row are based off of values A-E in a function.  The t values are the sums.  For ? I want to perform the same function on the column summaries I did on the columns themselves.

 I am creating the summaries in code in the InitializeLayout event of the grid with the following code:

e.Layout.Bands(0).Summaries.Add(SummaryType.Sum, e.Layout.Bands(0).Columns("Revenue"))

 

 

  • 469350
    Verified Answer
    Offline posted

    There are two ways to do this.

    If you are using regular summaries (not formula summaries via UltraCalcManager), then you would have to create an ICustomSummaryCalculator for your summary. This interface has several methods, but all you really need to do is use any one of them that passes you the Rows collection. Then you can use rows.SummaryValues to calculate your summary and pass it back from the interface. 

    The other option is to use UltraCalcManager and use formulas. You could then add a summary with a formula that adds up the individual summaries by name.