May 12, 2011 at 9:26 am
I might be overlooking the obvious, but I can't figure out how to display a zero (0) as a "-" in SSRS 2005 using Format codes. I have a column that contains either a 1 or 0, so rather than display zero, I'd like to display a dash. (I want to avoid using IIF() or Switch() functions)
Example:
Current Output=
ClientTrained?
==========
0
0
0
1
0
1
Desired Output=
ClientTrained?
==========
-
-
-
1
-
1
Thanks,
Pete
May 12, 2011 at 1:42 pm
2008 has a - for a 0 built in. When I choose it the expression it creates is:
0.00;(0.00);'-'
Try putting that in your format.
May 12, 2011 at 1:45 pm
looks same like iif
can i know why you want to avoid iif
thanks
Regards
Durai Nagarajan
May 12, 2011 at 6:42 pm
durai nagarajan (5/12/2011)
looks same like iifcan i know why you want to avoid iif
thanks
I have about a dozen columns in a table where the field values are either 1 or 0. For satisfactory display, it would be best to format the zeros to dashes. If a simple format code exists, then it saves the effort of having to write conditional expressions for each field.
May 12, 2011 at 10:41 pm
Daniel Bowlin (5/12/2011)
2008 has a - for a 0 built in. When I choose it the expression it creates is:
0.00;(0.00);'-'
Try putting that in your format.
Daniel -- thanks for checking SSRS 2008. That format code works. Ironically, as I was saving the formatting expression in a plain ol' text file within my "SSRS bag of tricks" folder, I discovered I had come up with the formatting code a long time ago -- I just didn't label the file very well.
So, I have your format code along with my original one =
#,###;(#,###);-
Looks like the third segment is what handles zeros.
Thanks again,
Pete
May 13, 2011 at 7:18 am
Is ther any way around for ssrs 2005.
thanks in advance.
Regards
Durai Nagarajan
May 13, 2011 at 4:07 pm
That format should work in 2005 also.
August 5, 2016 at 3:30 pm
Ideally you want #,##0.00;(#,##0.00);'-' Add a 0 if you don't want the 0 to drop off.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply