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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problems Filtering GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

63792 Jul 10,2007 07:12 AM UTC Jul 14,2007 04:42 AM UTC WinForms 3
loading
Tags: GridControl
Tim Cristofoli
Asked On July 10, 2007 07:12 AM UTC

Hi,

I am trying to filter records in a gridgroupingcontrol based on the values in 3 columns. It seems like it should be an easy thing to do but I cannot seem to get correct results.

My grid has a "service code" column with a code for a service type like "0", "1", "2", "A", "B", "C" etc., an "authorised" column that has a string value of either "0" or "1" and a "preferred" column that has a string of either "0" or "1" as well. The user is supposed to be able to select any combination of "service code", "authorised" and "preferred" values and the grid should display only the records that match the selected values.

For example, if I want to show only records where (("service code" = "1") and ("authorised" = "0") and ("preferred" = "1" or "preferred" = "0")) then a simplified version of my code looks like this:

private void filterGrid()
{
ggc.TableDescriptor.RecordFilters.Clear();
ggc.TableDescriptor.RecordFilters.LogicalOperator = FilterLogicalOperator.And;

String servicesFilterString = "([SERVICE_CODE] = '1')";
String authorisedFilterString = "([AUTHORISED] = '0')";
String preferredFilterString = "([PREFERRED] = '1' OR [PREFERRED] = '0')";

RecordFilterDescriptor rfd1 = new RecordFilterDescriptor(servicesFilterString);
ggc.TableDescriptor.RecordFilters.Add(rfd1);

RecordFilterDescriptor rfd2 = new RecordFilterDescriptor(authorisedFilterString);
ggc.TableDescriptor.RecordFilters.Add(rfd2);

RecordFilterDescriptor rfd3 = new RecordFilterDescriptor(preferredFilterString);
ggc.TableDescriptor.RecordFilters.Add(rfd3);

ggc.EndUpdate(true);
ggc.Refresh();
}

For some reason this approach doesn't seem to be working. For example, if I construct the "preferred" filter string as "([PREFERRED] = '1' OR [PREFERRED] = '0')" then the filter works as expected; however, if I construct it in the reverse order "([PREFERRED] = '0' OR [PREFERRED] = '1')" it doesn't filter the grid correctly (for example, all rows are filtered out of the grid when all rows should be displayed). Similarly, the order that of the conditions in the "services" filter string seems to affect whether the grid is filtered correctly and for certain seemingly random values all records in the grid are filtered out inexplicably. I can't see any reason why the order of the conditions should have any effect on the results.

Any help with this problem will be much appreciated!

Thanks!!

Tim Cristofoli
Replied On July 10, 2007 07:18 AM UTC

By the way, I am using Syncfusion version 4.2.0.6.

Administrator [Syncfusion]
Replied On July 10, 2007 08:06 AM UTC

Try removing the TIC marks.

String servicesFilterString = "([SERVICE_CODE] = 1)";
String authorisedFilterString = "([AUTHORISED] = 0)";
String preferredFilterString = "([PREFERRED] = 1 OR [PREFERRED] = 0)";



Tim Cristofoli
Replied On July 14, 2007 04:42 AM UTC

That seems to have fixed it. Thanks for the super quick help!!

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.

Warning Icon 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.Close Icon

;