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
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
HiDimitar
,I am traveling right now so i cannot test your solution but looks perfect for what I want to do
Thanks
Andrea
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
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
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.
Dimitar
Telerik by Progress
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
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