May 26, 2009 at 5:21 pm
I want to display a line on a Reporting Services Report based on several conditions.
ANNDEDDSC has an alpha value =
"Your annual deductible met to date is" but sometimes is blank
ADDDEDUCT has a value > 0 sometimes, sometimes 0.
I want to display a formatted zero 0.00 when ADDDEDUCT = 0
and ANNDEDDSC has an alpha value:
"Your annual deductible met to date is 0.00"
I want to display a blank when ADDDEDUCT = 0 and ANNDEDDSC = blank
" "
I tried this but it doesn't work, any suggestions?
=fields!ANNDEDDSC.Value & " " & iif(Fields!ANNDEDUCT.Value = 0," ",Fields!ANNDEDUCT.Value)
May 26, 2009 at 10:29 pm
This is one expression you could use for the cell value:
=IIF(Len(Fields!ANNDEDDSC.Value) = 0 And Fields!ANNDEDUCT.Value = 0, Nothing, Fields!ANNDEDDSC.Value & " " & Format(Fields!ANNDEDUCT.Value,"N2"))
May 27, 2009 at 12:37 pm
Thanks for your reply. I think this is very close but it still displays 0.00 when ANNDEDDSC = spaces.
I tried = " " but get a runtime #Error
=IIF(Len(Fields!ANNDEDDSC.Value) = " " And Fields!ANNDEDUCT.Value = 0, Nothing, Fields!ANNDEDDSC.Value & " " & Format(Fields!ANNDEDUCT.Value,"N2"))
May 27, 2009 at 1:32 pm
I got it to work with this:
=IIF(Fields!ANNDEDDSC.Value = " " And Fields!ANNDEDUCT.Value = 0.00, Nothing, Fields!ANNDEDDSC.Value & " " & Format(Fields!ANNDEDUCT.Value,"N2"))
Thanks for your help!
May 27, 2009 at 6:37 pm
And thank you for coming back and posting what worked. This way, others with a similiar problem can see what worked.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
May 27, 2009 at 10:40 pm
Well done. You can also make it work for both a zero-length string "" and a spaced string " " by inserting the Trim function:
=IIF(Len(Trim(Fields!ANNDEDDSC.Value)) = 0 And Fields!ANNDEDUCT.Value = 0, Nothing, Fields!ANNDEDDSC.Value & " " & Format(Fields!ANNDEDUCT.Value,"N2"))
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply