March 27, 2009 at 3:36 pm
i am trying to do iif then else in field expression in SSRS
(if field.city = "dallas" then
field.state = "texas"
elseif field.city ="atlanta" then
field.state = "geogria"
else
field.city
endif )
can you please let me know do the if then else condition in the expression of the field?
March 29, 2009 at 5:59 am
Unfortunately, the IIF statement is not as elegant as you would like. The syntax for it is quite similar to the syntax used by Excel...
IIF (Condition, result if true, result if false)
For you "Elseif", you would need to use another IIF statement - it gets real ugly if you have a few ELSEIF's.
So you statment would look something like:
IIF (Field.city ="dallas", "texas", iif (Field.city="atlanta", "georgria", field.city))
March 30, 2009 at 5:38 am
You can achieve this using switch statement.
Add the below expression in state field.
= switch(Fields!City.Value="dallas","Texas",Fields!City.Value="atlanta","geogria",true,Fields!City.Value)
Hope this will help you.
Still you have a problem pls feel free to revert back.
June 30, 2009 at 5:54 pm
My problem here - I am trying to label my status group as follows,
Reporting Services / Visual Studio only returns the first true value = "New Provider" for all other records the last statement "Full Time Provider" nothing for on call or part time.
=IIf(
Fields!status.Value = "NEW", "New Provider",
(IIf(Fields!status.Value = "OC", "On-Call Provider",
(IIf(Fields!status.Value = "PT", "Part Time Provider","Full Time Provider")))))
Any help is appreciated!
Thanks
July 1, 2009 at 4:02 am
Hi, 🙂
I guess, this can be acheived by using either nested IIf statements or SWITCH statement as
=Switch(Fields!Value1.Value, "Case1", Fields!Value2.Value, "Case2")
Please try...this should help... 🙂
Cheers,
Niraj Joshi
July 1, 2009 at 8:17 am
Thanks for the respsonse - did try SWITCH with the same result ... First value is returned correctly, else always the last value in the statement- the two in between are not shown.
July 1, 2009 at 9:02 am
Just a thought... double-check if your data is uppercase/lowercase. I've sometimes run into issues with SSRS being case-sensitive when evaluating values (i.e, If..Then).
July 1, 2009 at 6:11 pm
yeah - got it, looks in visual studio I can't do spaces
'Field' = "NEW" - doens't work
but
'Field'="NEW' works
I am so used using spaces in my old sql analyzer.
Thanks for you help !!! :w00t:
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply