Filter Multiple text condition

8 posts, 0 answers
  1. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 20 Nov 2016 Link to this post

    Hi all,
    i have a problem with a pivotgrid, as the title say i would like to add some filter conditions to my grid, below some lines of my code:

     

     this.radPivotGrid1.DataSource = LINQToDataTable(query);
                this.radPivotFieldList1.AssociatedPivotGrid = this.radPivotGrid1;

                this.radPivotGrid1.RowGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "STATUS", GroupComparer = new GrandTotalComparer() });
                this.radPivotGrid1.ColumnGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "SOMETHING", GroupComparer = new GrandTotalComparer() });
                this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "SOMETHING_ELSE", AggregateFunction = AggregateFunctions.Count });


                this.radPivotGrid1.AllowGroupFiltering = true;

                PropertyGroupDescriptionBase description = (PropertyGroupDescriptionBase)this.radPivotGrid1.RowGroupDescriptions[0];  //STATUS
                LabelGroupFilter filter = new LabelGroupFilter();
                TextCondition condition = new TextCondition();

                condition.Comparison = Telerik.Pivot.Core.Filtering.TextComparison.DoesNotContain;
                condition.Pattern = "SELLED";     <-------------- here i would like to insert more than one condition
                filter.Condition = condition;
                description.GroupFilter = filter;

    as you can read in the comment i would like to say, for example: "Display only if my STATUS is not "SELLED" or "LOST"

    There is a way to do it?

    thank you very much

     

    Andrea

  2. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 21 Nov 2016 Link to this post

    Hi Andrea,

    Thank you for writing.

    You can use SetCondition class for this:
    PropertyGroupDescription cityGroupDescription = new PropertyGroupDescription
    {
        PropertyName = "ShipCity"
    };
     
    LabelGroupFilter cityLabelFilter = new LabelGroupFilter();
    SetCondition citySetCondition = new SetCondition();
    citySetCondition.Comparison = SetComparison.DoesNotInclude;
    citySetCondition.Items.Add("Aachen");
    citySetCondition.Items.Add("Anchorage");
     
    cityLabelFilter.Condition = citySetCondition;
    cityGroupDescription.GroupFilter = cityLabelFilter;

    I hope this will be useful.

    Regards,
    Dimitar
    Telerik by Progress
    Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
  3. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 21 Nov 2016 in reply to Dimitar Link to this post

    HiDimitar

    ,I am traveling right now so i cannot test your solution but looks perfect for what I want to do 

    Thanks

    Andrea

  4. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 22 Nov 2016 in reply to Dimitar Link to this post

    Hi, i was able to try your solution but it does not seems to work.

    My property is made with the command:
                this.radPivotGrid1.RowGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "STATUS", GroupComparer = new GrandTotalComparer() });

    I created the SetCondition object with PropertyName "STATUS" and next i added the items with the filter words (my words appear in capitol so i created the string with all capitol letter) but when i execute my code no filter is applied to my table.

    Am i missing some points?
    thanks

    Andrea

     

  5. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 22 Nov 2016 in reply to Andrea Link to this post

    sorry for the double post, but i tried to do some experiments, it seems that the only condition that make some effects on my grid is the TextCondition, but i cannot find any way to add multiple condition to a TextCondition

    Andrea

  6. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 23 Nov 2016 Link to this post

    Hi Andrea,

    There is no way to add multiple conditions to a TextCondition. In addition, could you please share the entire condition that you are using along with some data used in the field that you want to filter? It would be even better if you could assemble a small sample that shows this case. 

    I am looking forward to your reply.
     
    Regards,
    Dimitar
    Telerik by Progress
    Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
  7. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 23 Nov 2016 in reply to Dimitar Link to this post

    Hi DImitar, thank for your replay,
    sorry but my code is confidential so i cannot post any part of it, by the way i was able to manage it by removing manually the fields from my datatable.
    Thank you very much for your help Dimitar

  8. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 24 Nov 2016 Link to this post

    Hi Andrea,

    I am glad that you have found a solution for this. Please do not hesitate to contact us with any other questions or concerns. 

    Regards,
    Dimitar
    Telerik by Progress
    Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Back to Top