OLAP WPF set a default filter

Posted by: abellisomi on 20 August 2020, 1:46 am EST

    • Post Options:
    • Link

    Posted 20 August 2020, 1:46 am EST

    Hello, I would like to set a default filter for a field. I can easily add it to the

    FilterFields
    list, however I want also to filter for a specific value.

    E.g. I want by default the Year of account to be filtered as the current one, if the users wants to take in consideration additional years they have to manually select it from the Field Settings… menu

  • Posted 21 August 2020, 7:32 am EST

    Hi,

    Yes, you can have filter the olap data with default filters. For this, after adding filter field to FilterFields collection, you need to access field.Filter and define its ShowValues (for numeric) or Condition1/Condition2, Operator and Parameter properties(for conditional filters), as follows:

    Access the Filter:

     var field = olap.Fields["Category"]; olap.FilterFields.Add(field); var filter = field.Filter;
    Numeric Filter:
    filter.Clear(); filter.ShowValues = new string[]{ "Beverages"};
    Conditional Filter:```

    filter.Clear();

    filter.Condition1.Operator = C1.Olap.ConditionOperator.GreaterThanOrEqualTo;

    filter.Condition1.Parameter = min;

    filter.Condition2.Operator = C1.Olap.ConditionOperator.LessThanOrEqualTo;

    filter.Condition2.Parameter = max;

    
    Regards,
  • Posted 23 August 2020, 11:11 pm EST

    Ruchir,

    thank you this worked perfectly.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels