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

IIF Function and Report Parameters

4 Answers 812 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bryan Hughes
Top achievements
Rank 1
Bryan Hughes asked on 11 May 2012, 03:56 AM
Not sure how I can make this work.  I get "Cannot perform '=' operation on System.Object[] and System.Int32"

Thanks for the help -- Bryan H
= IIf(Parameters.ParameterServiceTypeID.Value = 0, "Services: All", "Service: " + Fields.ServiceTypeName)

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 11 May 2012, 01:42 PM
Hello Bryan,

As noted in the Functions help article, the reporting engine first evaluates the function parameters (i.e. both parameters are evaluated prior to the function execution) and then passes the result values to the function. This means that you need to make sure the parameters of the function are valid statements prior to executing the function.

The ParameterServiceTypeID parameter should be of Integer type and it should have default value. When you do not set a default/initial value or do not set such value before the report rendering, the value of the parameter is evaluated to an empty string.

Kind regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Bryan Hughes
Top achievements
Rank 1
answered on 11 May 2012, 05:43 PM
The ParameterServiceTypeID was set as Integer and value = 0.
0
Bryan Hughes
Top achievements
Rank 1
answered on 11 May 2012, 06:03 PM
I tried IsNull in Iff expression but still same error.
= IIf(IsNull(Parameters.ParameterServiceTypeID.Value,0)=0, "Services: All", "Services: " + Fields.ServiceTypeName)
0
Bryan Hughes
Top achievements
Rank 1
answered on 11 May 2012, 06:17 PM
I was able to make it work by using the count of field instead of Parameter value.
= IIf(CountDistinct(Fields.ServiceTypeName)> 1, "Services: All", "Service: " + Fields.ServiceTypeName)
Tags
General Discussions
Asked by
Bryan Hughes
Top achievements
Rank 1
Answers by
Steve
Telerik team
Bryan Hughes
Top achievements
Rank 1
Share this question
or