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

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

5 Answers 307 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 19 Dec 2012, 01:51 PM
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?

5 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 21 Dec 2012, 03:26 PM
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!

0
Tim
Top achievements
Rank 1
answered on 21 Dec 2012, 04:29 PM
Argh, I was sooo close :-)

That did the job, thx.
0
Shweta
Top achievements
Rank 1
answered on 01 Mar 2016, 01:17 PM

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

0
Shweta
Top achievements
Rank 1
answered on 02 Mar 2016, 07:20 AM
Telerik team kindly revert on this as we are not getting anything on net for In filter
0
Stef
Telerik team
answered on 03 Mar 2016, 01:16 PM
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
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 1
Answers by
Stef
Telerik team
Tim
Top achievements
Rank 1
Shweta
Top achievements
Rank 1
Share this question
or