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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Reporting Srvcs - Help with a calculated field 1

Status
Not open for further replies.

JBourne77

IS-IT--Management
Jan 21, 2008
153
US
My company recently decided to transition from Crystal reports over to SSRS. Needless to say, I am scrambling to catch up to speed.

Just some insight, I have posted same questions on other forums. Here are the links if you need to see them so same advice and problems can be looked over (if needed).


I need some assistance with creating a calculated field. In my Crystal report, I created the following formula and then in turn grouped on it:

Code:
If {aaUDS7;1.ObsValue} > "1" and {aaUDS7;1.ObsValue} < "7" then "1. < 7" Else
IF {aaUDS7;1.ObsValue} >= "7" and {aaUDS7;1.ObsValue} <= "9" then "2. 7 to 9" else 
IF {aaUDS7;1.ObsValue} > "9" THEN "3. > 9" ELSE "3. > 9"

I need to mimic this in SSRS and not sure how to handle it correct.

I tried to set up my calculated field like this:


Code:
= If Fields!ObsValue.Value  > "1" and Fields!ObsValue.Value < "7" then "1. < 7" Else
IF Fields!ObsValue.Value  >=  "7" and Fields!ObsValue.Value <= "9" then "2. 7 to 9" else 
IF Fields!ObsValue.Value > "9" THEN "3. > 9"  ELSE "3. > 9"

but its telling me I have an "Unrecognized identifier" and underlines the first If in red. Any insight or help is deeply appreciated.
 
One possible way to accomplish this would be to use nested Iif statements....

The basic construct is

Iif(logical_expression, True value, False value)

I have not tested this....but something like the following could work....

Iif(Fields!ObsValue.Value > "1" and Fields!ObsValue.Value < "7", "1. < 7", Iif(Fields!ObsValue.Value >= "7" and Fields!ObsValue.Value <= "9", "2. 7 to 9", "3. > 9"))

Jen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top