Filtering Data Grid 2 via associated object

0
Hello everyone, I'm currently working on a project where I need to display instances of the Company entity (shown in the attached screenshot) in a Data Grid 2.I'm facing a challenge with filtering companies based on whether a user has marked them as a favourite. While I know this logic could be implemented using a microflow, I would prefer to keep the data source for the Data Grid as XPath, since I use its built-in pagination and would like to avoid manually handling that.Each user can mark any company as a favourite. What I need is to add a dropdown filter at the top of the column, allowing users to filter by the "Is Favourite" status, with the following options: Yes No Empty Has anyone encountered a similar use case or know of a clean solution?Big thanks for any help    
asked
1 answers
1

Hi Pawel,

     As of my understanding, If you want to continue using XPath in Data Grid 2 (to retain built-in pagination), but also allow filtering based on whether the current user has marked a company as a favourite, you can use the special [%CurrentUser%] token in your XPath constraint.

This way, you can filter companies marked as favourite by the current user.

To implement the dropdown filter:

  • Wrap your Data Grid 2 inside a Data View sourced via a microflow that returns the current user (e.g., Account).

  • Add a dropdown (Enum or helper object) to allow the user to pick the filter: Yes / No / Empty.

  • Use this input to either:

    • Adjust the XPath dynamically via visibility of separate Data Grids.

    • Or trigger microflows with filtered data (as a last resort if XPath alone can’t cover the use case).

This approach keeps the benefits of pagination and performance while offering dynamic filtering.

 

Mendix Community - Get Current User for XPath Data Source List View

Filtering Data on OverviewPage using XPath

 

Thanks

Guna

answered