Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If ..then..else expressions

Status
Not open for further replies.

IanWaterman

Programmer
Jun 26, 2002
3,511
GB
I am trying to create a text expression which outputs a report type.

I have a Parameter which can be populated with S, C or T and these relate to Summary, Claims or Transactions.

When I place the parameter on report its works fine, it appears in Expression dialog as

=Parameters!InputReportType.Value

If I change expression to

=if Parameters!InputReportType.Value = 'S' then 'Summary' else if Parameters!InputReportType.Value = 'C' then 'Claims' else 'Transactions'

Report fails to run with an error which states

Could not find file 'C:\TEMP\expression_host_858ead60c50041128a6a5a476a05bc75.dll'.
----------------------------
An unexpected error occurred in Report Processing.
----------------------------
The definition of the report ' is invalid.
----------------------------
An error occurred during local report processing.

Any suggestions as to what I am doing wrong will be gratefully received.

Ian
 
Worked out what I was doing wrong should be IIF and use " " to wrap text

Code:
=iif(Parameters!InputReportType.Value = "S", "Summary",
	iif(Parameters!InputReportType.Value = "C", "Claims", "Transactions"))

Ian
 
Since you have more than 2 possible parameter values I think it would be easier to read and maintain if you used the Switch function rather than nested IIf:
Code:
=Switch(Parameters!InputReportType.Value = "S", "Summary",
        Parameters!InputReportType.Value = "C", "Claims", 
        0 = 0, "Transactions")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top