This is a migrated thread and some comments may be shown as answers.

Filter Multiple text condition

7 Answers 91 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 20 Nov 2016, 07:41 AM

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

7 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 21 Nov 2016, 09:34 AM
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.
0
Andrea
Top achievements
Rank 1
answered on 21 Nov 2016, 05:12 PM

HiDimitar

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

Thanks

Andrea

0
Andrea
Top achievements
Rank 1
answered on 22 Nov 2016, 02:48 PM

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

 

0
Andrea
Top achievements
Rank 1
answered on 22 Nov 2016, 03:02 PM

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

0
Dimitar
Telerik team
answered on 23 Nov 2016, 12:33 PM
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.
0
Andrea
Top achievements
Rank 1
answered on 23 Nov 2016, 02:19 PM

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

0
Dimitar
Telerik team
answered on 24 Nov 2016, 07:26 AM
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.
Tags
PivotGrid and PivotFieldList
Asked by
Andrea
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or