Hello Fob,
This is a very interesting problem but I think we can't fix it easily by simply focusing on the grid & xpath or DS microflow
I think you should use OQL (view entities) to achieve this. There's a cool function named COALESCE
https://docs.mendix.com/refguide/oql-expression-syntax/#coalesce-expression
This may achieve what you want because you can it returns the value of the first expression that is not NULL. Can be used with columns.
Check the examples here ->
https://docs.mendix.com/refguide/oql-expression-syntax/#coalesce-expression-examples.
The advantage of this one is that you can extend the OQL query to sort based on it. Should be possible somehow
Hope this helps!
hi,
This is expected behavior.
In Mendix, sorting always happens on the datasource, not on what is rendered in the UI. A custom content column with visibility conditions doesn’t represent a single attribute, so the grid has nothing concrete to sort on.
What we usually do in this situation is introduce a single “display” attribute and sort on that.
For example:
DisplayName attribute to the entityfirstName is not empty → use thatsecondNameThen:
DisplayNameIf you’re using a microflow datasource, you can also calculate DisplayName there and return the list already sorted.
There’s no supported way to sort based on visibility logic or custom content alone. The sort key must always be a real attribute in the datasource.