In a visio assinged to a protocol I want a shape that shows the text of the Element Description, if it exists, or otherwise just show the Element Name
In this screenshot we see both the Description and the Name.
The best way I can come up is to have two shapes layer over each other.
The top shape with [Description] and the behind shape [Element Name]
Then to use conditional actions to Hide the top level shape [Description] if the Description is not set at all within the element and is an empty string or null value.
Here is a test shape I have for the description to attempt to hide it if it is not set.
<A>-A|Element:[this element]|Description|=null
I have tried numerous variations of the Hide conditions, or even tried reversing logic and using Show instead but have reached a dead end.
<A>-A|Element:[this element]|Description|=null
<A>-A|Element:[this element]|Description|=
<A>-A|Element:[this element]|Description|=""
Is it possible to hide a shape based on the element not having a Description?
Or otherwise an alternate approach I could take to achieve the desired outcome highlighted above
Hi Sam / Steve,
If we are looking for just a text representation, I think another alternative is with the RegexReplace placeholder. The trick is to detect when the [Description] placeholder is empty and then replace that with the [Element Name] placeholder:
The above shape configuration will change the text based on the assigned description:
I tested on DataMiner 10.3.8, but hopefully, it will work on the previous 10.X versions.
This is brilliant – thank you Gelber!!
Can we please update your post to be marked as the answer instead!
I used another Regex to simplify the Element Name based on the naming convention we use.
[regexreplace:( d{3}D d{4}),[Element Name],]
So I cascaded that within your brilliant Regex.
So now if a description exists it will use that, otherwise it will use a trimmed element name instead!
[RegexReplace:^$,[Description],[regexreplace:( d{3}D d{4}),[Element Name],]]
Nice solution Gelber, thanks for sharing.
I forgot to mention any comma (,) character in the description may break the RegeReplex. In that case, we will need additionally a [Sep] placeholder to define a different separator character in the [RegexReplace] (As explained in our documentation here)