Solved

conditional formatting with nulls.

Posted on 2013-06-25
3
345 Views
Last Modified: 2013-06-26
I'm trying to change the background color of a textbox based on values. Right now I have values that have nulls but I can't seem to get that to work. I want the background to be white if null. This is what I have tried so far.

=SWITCH(Fields!field1.Value < 90,"Red",
Fields!field1.Value = "","white",
Fields!field1.Value is nothing,"white")
0
Comment
Question by:NickMalloy
3 Comments
 
LVL 12

Expert Comment

by:duttcom
ID: 39276661
Try this instead -

=IIF(IsNothing(Fields!field1.Value), "White", "Red")

This will set the background to white if field1 is empty and red if it contains a value.
0
 

Author Comment

by:NickMalloy
ID: 39278359
It can't be read for any value. It has to be red only if the condition applies. I tried this and it still colors red when the item is blank.

=SWITCH(Fields!Field1.Value < 85,"Red",
IsNothing(Fields!Field1.Value), "White")
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 300 total points
ID: 39278891
The Switch function evaluates from first to last expression, this should have a better result:

=SWITCH(IsNothing(Fields!Field1.Value), "White",
  Fields!Field1.Value < 85,"Red")

If that still doesn't work, try this:

=IIF(IsNothing(Fields!Field1.Value), "White",
  Switch(Fields!Field1.Value < 85,"Red", true, "White"))
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question