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.
Hi Sam,
It does no look like we can use the Hide/Show function with the Element Description field. However, as a work around, you can create a custom property (right click element and select properties, then custom. Click the gear (bottom left) to add new property). In my case I created one called 'DescUsed' and set the value to 1 for used then blank or 0 for not used. Once this is setup you can add a Shape Data Field of 'Show' to your shape with the value being:
<A>-A|Element:MS Platform|Property:DescUsed|=1
<A>-A|Element:[your element name]|Property:[your custom property name]|=1
As for Displaying the shapes, you are correct and will need two stacked shapes. However, using this property method you can use 'Show' for the Description and 'Hide' for the Element Name shape, when the [custom property]=1, to reduce the number of shapes used when rendered in Cube, though not necessary.
Thank you Steve for confirming that wasn’t possible
Thank you for the workaround example.
And Great tip making sure to Hide the other shape when not needed to prevent shape doubleups
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)