Hi community,
I am working on an element visio file where I need to show or hide a button that launches an automation script based on the contents of an element property ("Operational Status"). The property can have two values ("Available" or "Maintenance") or can be empty (e.g. when a new element is created, the property will not have any value yet).
I want the shape to be shown when the property has value ("Available") but also when the property does not have a value yet. But so far no luck.
The shape itself is linked to an automation script with an Execute shape data field. In addition I added the following Show shape data field
So the shape should be shown when the property value is "Available" or when it is empty.
When the value "Available" is populated on the property, the shape is shown as expected. Also when I clear the value from the property, the shape is still shown. But when I close the element card and re-open it (with the property still empty), the shape is never shown until I populated the property with the correct value.
I also tried an alternative approach by using and adding a Property shape data field in combination with a Hide option.
That works better. The shape is shown also when opening the element card while the property has no value yet. But unfortunately then I am loosing the ability to execute a script. The button is not clickable anymore to launch the script, probably due to the extra Property shape data field on the shape. So that is not really an option.
I also tried a "Hide" shape data field in combination with te Execute shape data field but that suffers from the same behavior as initially explained (shape not shown when opening the element card while property is empty).
Do you have any ideas how I could solve this issue?
The property placeholder (and other placeholders) have specific behavior where a shape will not be initialized until the placeholder resolves. Because the value is empty, the shape does not get initialized and thus the condition does not evaluate. You can work around this by using the "AllowEmptyDynamicValues" option on the shape. But that is the less elegant solution.
The cleaner fix is to use the "Property:" syntax on the condition itself rather than a placeholder.
You can then formulate your "Hide" condition as such: <A>-A|Element:[this elementID]|Property:Operational Status|=Maintenance
Note that I opted for the "this elementID" placeholder rather than "this element" on the off chance that your element name contains a '|' or '-' character and a separator problem occurs in the shape data.