My grid has the following columns:
Codenumber | Price | Component | Qty
123 10 ABC 1
123 10 DEF 2
123 10 GHI 3
456 50 JKL 4
456 50 MNO 5
I need to group by codenumber and price, but they should both be on the same line. It shouldn't go from Codenumber down to price and then down to component and qty. Codenumber and price should be 1 group.
I also need to do this in code since I am supplying the datasource at runtime and can have different columns. Depending on the columns I may not want to group it this way.
Is there some kind of property to set this or code that can group it this way?
I appreciate any help. Thank you.
The easiest way to handle this would be to use an unbound column. What you would do is use the InitializeLayout event of the grid to add a column to the root band. You can make the DataType of this column anything you want, but I would probably use a string, and then you can populate the column with values containing what you want displayed in the GroupByRow.
Then you group the grid by the unbound column (also in InitializeLayout).
Then you would use the InitializeRow event to populate the unbound column with the combined values of the Codenumber and Price columns.
Hi Mike,I currently read this article because I need something similar like bdisk. This is few years old now so maybe there is another solution.I am searching for the following:I have e.g. 6 rows in my grid with the following properties:1 age 20, job developer, country UK2 age 20, job developer, country UK3 age 25, job doctor, country USA4 age 25, job doctor, country USA5 age 30, job professor, country DE6 age 32, job worker, country DEThe only thing which I found is that the grid does the group by only on just one property. So first the age is grouped by, then the job and then the country.So in result I have three bands. But I now want a general group by on all the three parameters like it would be in a SQL statement on database.So row 1 and 2 should be grouped by because all values are the same. Same thing for row 3 and 4. Row 5 and 6 are the only rows with its combination so they are "alone".So after grouping by I want as result 4 rows in my grid. When I expand the first group by row, the row 1 and 2 should be visible as child bands, when I expand second group by row, row 3 and 4 are visible as child rows and so on...Is this behavior possible in any way?
Thanks in advance,
Alex
Thanks for your reply. I tried this out and it did the job.
In the end, though, I'm going to use a multi-banded grid instead because it looks neater.
Thanks again.