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
1995
Summaries Column Based On another Column
posted

 Hai,

I am using wingrid for my application.. How to give the formula for summary row for One column based on other column condition..

I am using Two column.. Colum A and Column B.. I Need Sum of column B When Column A contains the value A..  I have written the following.. But Incorrect type of arguments or Oprend Error Raised.. Please Give me the solution...

UltraGrid1.DisplayLayout.Bands(0).Summaries.Add(
"Summary", Infragistics.Win.UltraWinGrid.SummaryType.Formula, Me.UltraGrid1.DisplayLayout.Bands(0).Columns("B"), Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn)

UltraGrid1.DisplayLayout.Bands(0).Summaries("Summary").Formula = "SUM(IF(([A] = 'A'),[B],0))"

UltraGrid1.DisplayLayout.Bands(0).Summaries("Summary").DisplayFormat = "Total= {0}"

Regards

Suresh

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Suresh,

        I don't think you can do this with a single formula. What I would do is add an unbound column (C) to the grid. Set a formula on this column like:

        "if( [A] = 'A', [B], 0)"

        Then you can sum this unbound column for your summary:

        "sum([C])"

Children