how to filter string column using contains and start with

2 posts, 0 answers
  1. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 26 Jul 2013 Link to this post

     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;
                    }
  2. Elian
    Admin
    Elian avatar
    435 posts

    Posted 31 Jul 2013 Link to this post

    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.

  3. DevCraft banner
Back to Top