Hi, can UltraGrid meet the requirement as follows:
there are 6 rows and 3 columns, the target rows will be 4 rows after it is group by with the COL1 and COL2.(just like the SQL group by: SELECT * FROM XXX GROUP COL1,COL2)
The raw data given by XML:==========================|#|COL1 | COL2 | COL3|=|======================|1|A | B | 2|-|----------------------|2|A | B | 1|-|----------------------|3|M | R | 4|-|----------------------|4|X | C | 5|-|----------------------|5|X | C | 2|-|----------------------|6|X | N | 6|-|----------------------
The target rows to by shown in grid on the winform:+++++++++++++++++++++++++++++++++++++==========================| |COL1 | COL2 | COL3|=|======================|-|A | B | 3|-|----------------------|-|M | R | 4|-|----------------------|-|X | C | 7|-|----------------------|-|X | N | 6|-|----------------------
is it possible for UltraGrid?
Thansk a lot.Felix
Hello felixsen,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Hi,
Sorry... I made a mistake. What you need here is a GroupByEvaluator, not a GroupByComparer. I'm sure there are some samples of these here on the forums. But your situation is a little tricky. You won't be able to get exactly what you have here - and I'm not sure what assumptions you can make about the data (is it always in order) and what parts of your requirements are flexible.
In the simplest case, what you would do is handle GetGroupByValue and combine the two values from Col 1 and Col 2 into a single value.
I have a attached a sample project here which is about as close as I can get to what you want. I am assuming that the data in your data source is always sorted in the correct order.
Is there any demo code snippet for the usage of GroupByComparer?
Thanks.
Hello Felix,
The easiest way to do this would be to build a data source using this SQL Statement. You could populate a DataSet, for example.
If you want to manipulate the data in the grid, then this will require more work. There are a number of approach you could take. Using the grid's OutlookGroupBy feature will get you part of the way there. If you use a GroupByComparer, you can group on two columns and treat them as one, just like you have done here.
Summing up the values of Col 3 would be a simple matter of adding a summary to the Summaries collection on the band.