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
225
Grid summary
posted

I have 5 columns on a grid (flat band), say column 1, 2 (type string), 3, 4, 5 (type TimeSpan).

column 2 value can be either "IN" or "OUT".

I like to have the following summary at the end:

  TOTAL = count (total rows)

  "Column 5" = Sum of column 5 (form all rows)

  "Average Column 5 ID" = Sum of column 5/ TOTAL

  "Grouped by Column 2 - "IN"" = count (rows of data with column 2 = IN)

  "Column 2 - "IN" = sum of column 5 (from rows of data with column 2 = IN)

  Questions:

   - can I do that in WinGrid?

  - any quick pointer on how to do it?

Thanks in advance for your help.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    There's nothing built-in to the grid to do a conditional summary like this. But there are a couple of ways you want do it.

    1) Use an unbound column - you could add an unbound column to your grid using the InitializeLayout event. The column could be hidden. Then you would use the InitializeRow event to populate the hidden unbound column with a 1 or a 0 based on the value of Column 2. So it would be 1 for "IN" and 0 for anything else. Then you could sum up the unbound column to get a count of the "IN" cells.

    2) You could use an ICustomSummaryCalculator to calculate the summary yourself.

Children