We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grouping Engine

Thread ID:

Created:

Updated:

Platform:

Replies:

29904 Jun 6,2005 07:52 PM Jun 7,2005 03:44 PM Windows Forms 3
loading
Tags: Grouping
Eric Robishaw
Asked On June 6, 2005 07:52 PM

I''d like to use the grouping engine to return a list of unique items in a table. Can you help... If I have a table with a column X, I want a list of all the unique values of x (equivalent to "Select distinct X from t") Here''s what I''ve figured out: Syncfusion.Grouping.Table theTable; Syncfusion.Grouping.Engine engine = new Syncfusion.Grouping.Engine(); //get all the ArrayList list = new ArrayList(gridData.Rows.Count); foreach (DataRow row in gridData.Rows) { list.Add(AquadorNET.DataExtraction.GetIntFromDBObject(row["X"], -1)); } engine.SetSourceList(list); theTable = engine.Table; I know engine.Table has to have the info I want, I just can''t figure out the namespace. Thanks

Administrator [Syncfusion]
Replied On June 7, 2005 05:52 AM

You could use the grouping engine to do this by adding a SummaryDescriptor of type FilterBarChoicesSummary. This is the way the GridGroupingControl gets its unqiue values for its filtercell dropdowns. The Values property will returns a list of unqiue values. But since you are moving your list into an arraylist anyway, you could just sort teh arraylist and remove the duplicates turning the array list in a list of unique values.
ArrayList list = new ArrayList (gridData.Rows.Count);
foreach (DataRow row in gridData.Rows)
{
     list.Add(AquadorNET.DataExtraction.GetIntFromDBObject(row["X"], -1));
}
list.Sort();
int i = 0;
while (i + 1 < list.Count)
{
    if(list[i] = list[i+1]
    {
        list.RemoveAt(i);
     }
     else
        i += 1;
}
I did not run the above code, so I may have overlooked something, but this is similar to the technique we use the CreateUniqueEntries code in the GridDataBoundGrid FilterBar if you need to see some working code.

Eric Robishaw
Replied On June 7, 2005 09:18 AM

>You could use the grouping engine to do this by adding a SummaryDescriptor of type FilterBarChoicesSummary. Can you provide a quick example... I cannot find FilterBarChoicesSummary in the namespace (using 2.2). Is there a way to use a DataTable as the engine''s Source Data, besides enumerating each row and adding values to an arraylist?

Administrator [Syncfusion]
Replied On June 7, 2005 03:44 PM

FilterBarChoicesSummary is not in 2.2. It is in 3.x. You can make a DataView the datasource, either : engine.SetSourceList(dataTable1.DefaultView); or engine.SetSourceList(new DataView(dataTable1));

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;