Can't seem to get Filter expression to work when Case Sensitive

6 posts, 1 answers
  1. Tim
    Tim avatar
    40 posts
    Member since:
    Sep 2012

    Posted 19 Dec 2012 Link to this post

    I've read the article at Telerik Blog regarding using a function to UPPER any text for a filter.  My Filter does work when the case is correct, ie. 'Framework' but 'framework' does not.  I'm doing this in code and i'm using the StringToUpper() function from the above blog.  When I apply, no records are found at all.

    My code looks like this.

    Telerik.Reporting.Filter newfilter = new Telerik.Reporting.Filter();
    newfilter.Expression = StringToUpper("=Fields.AgreementName");
    newfilter.Operator = Telerik.Reporting.FilterOperator.Like;
    newfilter.Value = "%" + filter.ToString()) + "%";
    table1.Filters.Add(newfilter);

    The resulting Expression looks like this
    {=FIELDS.AGREEMENTNAME Like %FRAMEWORK%}

    This returns 0records....Ideas?
  2. Answer
    Stef
    Admin
    Stef avatar
    3047 posts

    Posted 21 Dec 2012 Link to this post

    Hi Tim,

    Please, notice that in the article Filtering with string parameter that allows free user input we're using Expressions and User Functions. In code you will have to build the same expression like so:

    Telerik.Reporting.Filter newfilter = new Telerik.Reporting.Filter();
    newfilter.Expression = "= UserFunction_Assembly.UserFunction_Class.StringToUpper(Fields.Name)";
    newfilter.Operator = Telerik.Reporting.FilterOperator.Like;
    newfilter.Value = "%" + someValue.ToUpper() + "%";
    table1.Filters.Add(newfilter);

    I hope this helps.

    Kind regards,
    Stef
    the Telerik team

    HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

  3. DevCraft banner
  4. Tim
    Tim avatar
    40 posts
    Member since:
    Sep 2012

    Posted 21 Dec 2012 Link to this post

    Argh, I was sooo close :-)

    That did the job, thx.
  5. Shweta
    Shweta avatar
    3 posts
    Member since:
    Mar 2016

    Posted 01 Mar Link to this post

    I am working on Telerik Report and i want to add filtering on report parameter. I have two multi value dropdowns. When multiple values from one box is selected data in other multi value box is  filtered. I am having issue with FilterOperator.In as not getting how to pass multiple comma seperated values to it. Below is my code:

     var calendarPara = new ReportParameter(FacilityScheduleParameter.Calendar, ReportParameterType.String, null);
                calendarPara.Visible = true;
                calendarPara.AvailableValues.DataSource = calendarList;
                calendarPara.AvailableValues.DisplayMember = "=Fields.CalendarName";
                calendarPara.AvailableValues.ValueMember = "=Fields.ID";
                //calendarPara.AvailableValues.Filters.Add("=Fields.BookingType=Parameters.Event OR Parameters.Event='" + GetDataSourceSql.AllValue + "' OR Fields.BookingType='" + GetDataSourceSql.AllValue + "'",
                //            Telerik.Reporting.FilterOperator.Equal, "=True");

                calendarPara.AvailableValues.Filters.Add("=Fields.Category", Telerik.Reporting.FilterOperator.In, " ='Acat','11111','Xyz' ");

     

     

    Filter is not working, i am not getting correct syntax.

    Please help as stuck in it and have very important delivery to wind up

  6. Shweta
    Shweta avatar
    3 posts
    Member since:
    Mar 2016

    Posted 02 Mar in reply to Shweta Link to this post

    Telerik team kindly revert on this as we are not getting anything on net for In filter
  7. Stef
    Admin
    Stef avatar
    3047 posts

    Posted 03 Mar Link to this post

    Hi Shweta,

    When you use the In operator the right side of the filter must contain a collection of objects. Such can be created from listed values by using the built-in Array utility function.

    In your code snippet, you specify the values as follows:
    ='Acat','11111','Xyz'
    to create a valid collection of the above values, the expression must be modified to:
    =Array('Acat','11111','Xyz' )


    The recommended approach is to test creating sample reports with the VS Report Designer, which will let you check all required settings and validate your code through the code auto-generated in the report's designer.cs|vb file.


    Please note that we cannot guarantee you a response by Telerik representative in forums. If it is an emergency, please use the support ticketing system to submit an inquiry and details about the problem.
    Thank you for your understanding.

    Regards,
    Stef
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner