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

how to filter string column using contains and start with

1 Answer 328 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 2
Mohammed asked on 27 Jul 2013, 03:35 AM
 dear team,
i'm trying to filter table pragmatically,
i use the below code and it is working only for equal to, how can i do the same for start with and contains operators because the below code not working for them.
do i miss something 
switch (Operator) {
                    case ("Contains"):
                        objFilter.Operator = Telerik.Reporting.FilterOperator.Like;
                        objFilter.Value = string.Format("%{0}%", FieldValue);
                        break;
                    case ("StartWith"):
                        objFilter.Operator = Telerik.Reporting.FilterOperator.Like;
                        objFilter.Value = string.Format("{0}%", FieldValue);
                        break;
                    case ("EqualTo"):
                        objFilter.Operator = Telerik.Reporting.FilterOperator.Equal;
                        objFilter.Value = string.Format("{0}", FieldValue);
                        break;
                    default:
                        objFilter.Operator = Telerik.Reporting.FilterOperator.Equal;
                        objFilter.Value = string.Format("{0}", FieldValue);
                        break;
                }

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 31 Jul 2013, 02:43 PM
Hi Mohammed,

The code looks logically correct and it should be working. From the snippet that you have posted there isn't information if you are setting the Expression of the filter. Additionally check the values of the FieldValue variable. You can try to serialize the report definition and see what are the final filters that are created. This might give you a clue on what's wrong. 
 

Regards,
Elian
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
Mohammed
Top achievements
Rank 2
Answers by
Elian
Telerik team
Share this question
or