Search code examples
c#filterbooleandevexpressxtrareport

DevExpress XtraReport: boolean filter


I'm working with devexpress and xtrareport tool.

I have done a filter with a boolean paramenter, defined in this way:

this.FilterString = "[ABILITATO] = ?abilitatoParam";

it works but... if I want to see records with ABILITATO set to true, I click on True and the same fo False. But if I want to see all the record, without filtering?


Solution

  • Done with a string filter.

    I use the event ParametersRequestSubmit. Then I check the parameters and I set the value I want:

    if (e.ParametersInformation[0].Parameter.Value.ToString() == Application.Current.FindResource("Abilitati").ToString())
        e.ParametersInformation[0].Parameter.Value = "True";
    else if (e.ParametersInformation[0].Parameter.Value.ToString() == Application.Current.FindResource("Disabilitati").ToString())
        e.ParametersInformation[0].Parameter.Value = "False";
    else if (e.ParametersInformation[0].Parameter.Value.ToString() == Application.Current.FindResource("Tutti").ToString())
         e.ParametersInformation[0].Parameter.Value = string.Empty;
    

    and this is the filter string:

    "Contains([ABILITATO], ?abilitatoP)"