My question is at the end of the post, but first I will give an example of the behavior I'm trying to replicate... When writing a label expression in VBScript, I sometimes take advantage of the difference between '+' and '&' when concatenating attributes and text. For example, lets say I'm labeling sewer pipes. I could write the following expression:
[LENGTH] & " ft. " & [DIAMETER] & "-inch " & [MATERIAL] & " @ " & [SLOPE] & "%"
And assuming the attributes are fully populated, the label might look like this:
50 ft. 12-inch PVC @ 2.5%
But sometimes we don't have all the information. If an attribute is missing (let's say the slope), the bits of text supporting it, "@ and %", would still be hanging there:
50 ft. 12-inch PVC @ %
We likely don't want that to happen. By tying two or more elements together with '+' instead of '&', any element tied to a null value will be ignored. Consider the following modified example:
[LENGTH] + " ft. " & [DIAMETER] + "-inch " & [MATERIAL] & " @ " + [SLOPE] + "%"
Now if the slope attribute was null, the "@ and %" would be left out like this:
50 ft. 12-inch PVC
If just the length was null:
12-inch PVC @ 2.5%
If the diameter and material were null:
50 ft. @ 2.5%
You see we have a fairly flexible expression. Finally, if you were to use only '+' operators, and no '&'...
[LENGTH] + " ft. " + [DIAMETER] + "-inch " + [MATERIAL] + " @ " + [SLOPE] + "%"
...Then whenever any attribute is missing, the entire label will be left out. The effect can be a useful visual cue. A pipe's label would be missing entirely until every attribute needed for the label had been populated.
Finally, my question...
In Arcade label expressions, it seems that '+' behaves the same way '&' does in VBScript. Is there a similar easy way to achieve the behavior I've described of the VBScript '+' using Arcade, without to having check for nulls using IsEmpty?
Thanks!!