Showing posts with label red. Show all posts
Showing posts with label red. Show all posts

Wednesday, March 7, 2012

Conditional Formatting Question

I have a column that contains either a test score or the state abbreviation where the student passed a particular test. I want the text to be red between 100-159, green greater than or equal to 160 and black otherwise.

This is what I've tried to take care of the scores:

=IIf(Fields!Score.Value <= 159 and Fields!Score.Value > 100,"Red", "Green")

Two issues:
I want all other scores (< 100) to be Black and
I'm not sure how to deal with the state abbreviations. I'm assuming this is why I receive this error:

[rsRuntimeErrorInExpression] The Color expression for the textbox ‘Score’ contains an error: Input string was not in a correct format.
Preview complete -- 0 errors, 1 warnings

All data is stored as varchar.

Hello,

Yes, the reason you get that warning is because your field is stored as varchar. I think this will do what you want, you can add additional conditions for different colors.

=Switch(

IsNumeric(Fields!Score.Value) and cInt(Fields!Score.Value) >= 160, "Green",

IsNumeric(Fields!Score.Value) and cInt(Fields!Score.Value) > 100, "Red",

1=1, "Black"

)

Jarret

|||Thanks. That did it.

Conditional Formatting on Datetime Field

I am building a report with a query that includes a field of type datetime.
I would like to change the color of the text in this column to RED if the
value contained in the field is earlier than now() - 10 minutes. I would
appreciate direction as to the appropriate function to use in this scenario.
I have tried to work with datediff, but without positive results.
Regards,
Pete Zerger, MCSE(Messaging)
Co-founder and Webmaster, MOMReourcs.org
URL:http://www.momresources.org
mailto:pete.zerger@.gmail.comWill something like this work for you?
=iif(Fields!EventDate.Value < dateadd("n", -10, Now()), "Red", "Black")
Regards,
Dan