Using Data Graphics with empty Shape Data fields

Today I was asked how you can display an icon on a shape (using an icon from the Data Graphics Icon Set feature) when a particular Shape Data value is NOT set to a value.  For example, lets say you have a diagram of your network and you want to display an icon on the Server shape when its Network Name property does not contain a value.

image

This is actually not as straightforward as you might think.  What most people do not realize is that the Shape Data Value cell can contain three different states when the data type for the cell is set to a string.

1. Contains a string value

image

2. Does not contain a value – empty string (notice the open and closed quotations)

image

3. Does not contain a formula (No Formula)

image

For this scenario you actually have to create a custom formula for your Data Graphic that tests for these conditions.

First we need to test the Shape Data cell to see if the cell contains a formula or not.
If the cell does not contain a formula then we simply return FALSE.
If the cell does contain a formula then we need to perform a test to see if the value is a 0 length string or not.

Here is the formula:
IF(FORMULAEXISTS({Network Name}),LEN({Network Name})>0,FALSE)

With this custom formula set, you can then set the rule for the icon that you want to display to FALSE and the icon will appear on the shape when the value of the Shape Data field is not set to a value.

image