iif expression...need to add another condition...  
Author Message
KenRoot





PostPosted: Tue Aug 09 08:23:01 CDT 2005 Top

SVCS >> iif expression...need to add another condition... Ok,
This expression for the font color is great:
=IIf(Fields!Purchase.Value < 0, "Red", "CornflowerBlue")
It changes negatives to red, positives to CornflowerBlue.
However, I need 0 (zero values) to be White, so that there is the third
color.
Any help is appreciated.
Thanks,
Trint

Information Technology199  
 
 
MarekDziedzic





PostPosted: Tue Aug 09 08:23:01 CDT 2005 Top

SVCS >> iif expression...need to add another condition... My only suggestion is to have a nested "iff" I do this quite a bit.

=IIf(Fields!Purchase.Value < 0, "Red", IIF(Fields!Purchase.Value = 0,
"White","CornflowerBlue"))

Hope that works.

"trint" wrote:

> Ok,
> This expression for the font color is great:
> =IIf(Fields!Purchase.Value < 0, "Red", "CornflowerBlue")
> It changes negatives to red, positives to CornflowerBlue.
> However, I need 0 (zero values) to be White, so that there is the third
> color.
> Any help is appreciated.
> Thanks,
> Trint
>
>
 
 
timseal





PostPosted: Tue Aug 09 08:54:07 CDT 2005 Top

SVCS >> iif expression...need to add another condition... You might find it easier to maintain with this kind of approach:

=getPurchaseColour(Fields!Purchase.Value)

... and have a function like this (pseudocode)..

friend function getPurchaseColour(value) as string
if value<0 return "Red"
if value=0 return "White"
return "CornflowerBlue"
end function