Paramenter/Filter case sensative?

4 posts, 0 answers
  1. Matt
    Matt avatar
    8 posts
    Member since:
    Feb 2005

    Posted 23 Sep 2008 Link to this post

    How to make Telerik report Parameter/Filter searching none case sensative?
    If I set field TOPIC as Paramter as well as Filter, I try to find "school", get search result, I try to search 'School' returns nothing.

    The "Like" filter operatior doesn't seem to work also. If I serach "schoo" I get nothing, unless I try "school".

    Did I miss anything?  My dataset case sensative is set false as defaut setting.
  2. Milen
    Milen avatar
    180 posts

    Posted 24 Sep 2008 Link to this post

    Hello Suzanne,

    The string comparison is case sensitive by design. The reason is that if one needs to make it insensitive, it can be easily achieved by applying ToLower or ToUpper on both the left and right sides of the comparison.
    But if the comparison was case insensitive and you needed sensitivity, your hands would be tied.

    So in your case you can write an user defined function, for example:

            public static string StringToUpper(object value)
                if (null == value || System.DBNull.Value == value)
                    return string.Empty;
                return value.ToString().ToUpper();

    Then in the filter use:
            =StringToUpper(Fields.MyField)   =   =StringToUpper(Parameters.MyParameter)

    Also as an alternative of the user defined function you can use the string.ToUpper method directly in the expression but you need to ensure a not null value. Something like:
            =CStr(IsNull(Fields.MyField, "")).ToUpper()   =   =CStr(IsNull(Parameters.MyParameter, "")).ToUpper()

    As for the Like operator to work, in the right side of the operator you need to use some wild card symbol(s), just like in SQL, something like:
            =StringToUpper(Fields.MyField)   Like   ="%" + StringToUpper(Parameters.MyParameter) + "%"

    Try it out and write us if you need further assistance.

    More info on User defined functions, operators, etc. you can find in the help topic Using Expressions.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Matt
    Matt avatar
    4 posts
    Member since:
    Sep 2013

    Posted 29 Sep 2014 in reply to Milen Link to this post

    I believe the issue that Matt is referring to is the fact that using the reporting API there isn't an option to ignore case.  String comparisons work well if you are directly building the filter critieria, but this doesn't apply to situations where you are using the API directly such as:


    Unless there is some property that I have overlooked.  I am running into the same situation.  I would like to turn off case-sensitivity for my report filter while still using the API.


    Matt R.
  4. Stef
    Stef avatar
    3610 posts

    Posted 30 Sep 2014 Link to this post

    Hi Matt,

    The suggested approach is applicable also if you are using directly the API to add a fileter. For example check the code snippets in the How to: Add filtering to Report article.

    To add a filter you need to specify the expression, the operator and the value to evaluate in code. The expression and value parts can be set to an expression as custom function or string formatted in code.

    In order to provide you more accurate suggestions, please elaborate on the scenario with code snippets and examples of specific values not working with the added filter.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top