See an example below of a reference selector that is visible based on an attribute:
In this case, the attribute is an enumeration. If the attribute was a boolean, you would be able to indicate if the widget is visible when the attribute is true or false.
Hope that helps,
If you are running Mendix 7 then you can add expressions in your conditional visibility https://docs.mendix.com/refguide7/conditions#21-showenable-element-based-on-attribute-value
If you use an older version I am afraid you will have to create a lot of FORM_hasXXXX attributes and use them solely for conditional visibility. Just try to avoid making them calculated attributes, this will have a very negative impact on performance.
I hope this helps,
Above is a solution, but you also can use a boolean.
This way the content will reveal if it will be shown yes or no:
Has contents? Yes - show No - don't
Hope this works for you.
If you are not running on Mendix 7 an alternative is the ShowByCondition widget. It's input is a microflow which will give back a boolean. Based on this boolean outcome it will show or hide the parent container and all it's child widgets (i.e. lower level DataViews over association) in it.