In DataGrid 2, filtering only works on persisted attributes at database level.
If your column uses a calculated attribute, the filter will not work because calculated attributes are evaluated at runtime, not stored in the database.
To solve this, you have two options:
First option (recommended):
Replace the calculated attribute with a persisted attribute and update its value using a microflow (for example on create/update events). This allows the database to filter correctly.
Second option:
Change the DataGrid 2 data source to a microflow and implement the filtering logic manually inside that microflow.
Best practice in enterprise apps is to avoid filtering on calculated attributes and use persisted attributes instead.
If this resolves the issue, please close the topic.
Not supported. Data Grid 2 filters & sorting only work on real database attributes (persisted fields). Calculated attributes aren’t filterable/sortable because they’re resolved at runtime and not part of the DB query.
Workable patterns:
CalcValueStored) and keep it in sync with events (Before commit, After commit, microflow on change, or scheduled job). Bind DG2 to this stored attr → native filters & sorting just work.Let me know if this helps
Hi,
You cannot directly apply a column filter in Data Grid 2 on a calculated attribute.
This is expected behavior.
Data Grid 2 filtering works at the database query (XPath/OQL) level.
A calculated attribute is evaluated in memory after retrieval, not stored in the database.
Since the value does not physically exist in the database:
That is why the filter option does not work.
Data Grid 2 filters only work on persisted database attributes.
Calculated attributes are evaluated at runtime and cannot be used in query filters.
If filtering is required, convert the value into a stored attribute or use a microflow data source.
This is by design in Mendix and aligns with how server-side filtering operates.
If filtering is required:
Now the value exists in the database, and Data Grid 2 can filter it normally.
This is the cleanest and most scalable solution.
If you must keep it calculated:
This works, but:
Use only if dataset is small or logic is complex.
Keep the calculated attribute for display.
Create a second stored attribute purely for filtering.
Synchronize it whenever source values change.
This gives best performance and flexibility.