Hi all,
I have created a windows form application in which I have used various Infragistics controls. I have used UltraGrid in one of my forms which is bound to a table available in SQL server database. I have some columns like Group1, Group2........Group6. Also, I have a column called Project Code whose cell values are just mere concatenation of all the group column values. Now, I want to group my Project Code Column depending upon the group columns. I have used a form for selecting which group columns to be included for grouping. For eg; if I select Group1 and Group2 columns for grouping, then the Project Code Column must be grouped according to Group1 and Group2 column. I don't have any idea how to achieve this. I hope you would get my question. If its still vague, then let me explain it in detail with some examples. Thank you very much in advance.
Thank you very much Mike. That was very helpful to me. I have finished the functionality using the SortedColumns.Add as directed by you. And if I had troubled or confused you, am very much sorry. Anyways thank you very much once again.
Okay.. it sounds like you are talking about OutlookGroupBy here. But I'm still a little unclear on the issue.
raghuramanv said:Lets say I have selected Code1, Code2 columns for grouping. Then the results should be bound accordingly in the grid in a hierarchical manner. In this scenario, under 01 two rows should come (since there are two rows with 01) and under 02 one row should come.
This doesn't make sense to me. If you grouped by both Code 1 and Code 2, wouldn't you then have three groups? The first two rows in this example have the same Code 1. So grouping by Code 1 would result in 2 rows like you describe. But the Code 2 values are different. So if you grouped by both fields, no two rows would end up under the same GroupByRow.
Anyway, if you want to group by a column, you simply use the SortedColumns.Add method on the band. The add method has a couple of optional parameters and the last one is a boolean which says whether or not to group. So in this case, you would probably clear the SortedColumns collection to reset it back to normal, then add Code 1 and then add Code 2.
That would results in 2 levels of grouping, though. If you want a single level of grouping based on two different fields, then what you would have to do is group by a single column and apply a custom SortComparer and GroupByEvaluator to that column.
Ok then let me explain it in detail. Let us take the columns as Code1, Code2, Code3. I have another column called Budget Code which is just combination of the values present in the Code 1,Code2, Code 3 Columns. for eg;
Apart from these columns I have some other columns like Amount, End Date,etc; I have a button called "Group By" in my form. If I click that button it would pop up with a form in dialog mode in which we would select the columns which would be involved in the grouping. Lets say I have selected Code1, Code2 columns for grouping. Then the results should be bound accordingly in the grid in a hierarchical manner. In this scenario, under 01 two rows should come (since there are two rows with 01) and under 02 one row should come. Similarly the hierarchy should go on depending upon the columns which I have selected for grouping. How could I achieve this? I hope I have explained in an understandable manner now.
Hi,
I'm having a hard time understanding your question. You are using the word group a lot and it has multiple meanings, so it's not clear to me what you want to achieve here. Your columns are called group, the grid has functionality to create groups of columns, and there is also OutlookGroupBy which groups rows. So if you can explain in more detail what you want, I'm sure I can point you in the right direction.