Conditional Visibility based on $currentObject=empty

Hi all, I just wanted to implement something that seemed like a trivial use case to me: I have a dataview with datasource microflow and in that dataview I want to switch between two buttons: If an object is returned I want to show button A and if no object is returned I want to show button B. So I expected that two visibility conditions would do the trick not($currentObject=empty) $currentObject=empty But while the first condition seems to work, the button with the second condition is never shown. Is this expected behaviour? Or a bug? And is there maybe another simple solution for this? regards, Fabian (Note that even though I'm currently using 7.10 I also tried with 7.13.1) Edit: At least I found a workaround. Make the button always visible on the page and hide it by css if the other button is shown .single-button-container { .btn + .btn { display: none; } }  
3 answers

Hi Fabian,

The simple solution would be to have button A inside the data view and button B outside the data view.

Then use some css to only show one button, e.g. by using first-of-type or something similar.



Because there is no entity to display when the microflow source returns no object, the UI has no 'place' to display the button.  In other words, the dataview doesn't have an object, so the button inside the dataview can't be placed on the page.

An idea to accomplish this:  return a 'parent' entity with an association to your original entity.  If the association is empty, display one button, if it is not empty, display another.



Hi Fabian,

What works (but is not that pretty) is to do conditional visibility using a random boolean attribute of the object. If you put everything in a container with visibility based on attribute (for example) isActive and check both True and False, the object will not be shown if its empty, and show up if it exists.