Source datagrid from OQL query - Mendix Forum

Source datagrid from OQL query


If your project has a complex security model and lots of data the performance of datagrids can and will quickly become super bad. Even with optimizing everything and relatively simple grids and simple queries. The security will quickly add joins and subqueries that could be optimized drastically or are sometimes not needed for simple overviews. 


Idea: To the list of retreive by xpath, database and microflow add OQL query. Map select parameters to columns. Support for aggregates and have sort, limit and offset variables to support paging and sorting.


This would be super helpful for larger projects with loads of data and security roles.  


Ps: the report grid is actually something in the good direction but lacks tons of features

2 answers

Yes, the datasource option used by the datagrid widget specifically. 

Technically it might be a bit harder to support OQL for a widget, but like you said using an external dataset for example would be nice. Actually we already have this feature for the report grid so I don't really see the problem here. The only thing needed would be to extend the report grid with all datagrid functionality such as aggregates, toolbar, search, sort and paging. 


Security wise there is always risk in using OQL, also when using it in a micrfolow. But that just means people have to be careful using it as the Mendix domain security model will not apply. 


I like the idea, but it's probably not the league of Mendix. You're referring to the data source options being used by widgets, right? 

For sure, executing any OQL definitely is a security leak. As it's hard to verify if the OQL is allowed to execute by the user based on his granted roles, the OQL's that may be executed should be predefined and separately granted access to (as a seperate project document, like a rule). As the result can have arbitrary columns, I don't think this can be implemented in widgets easily.

I'm still convinced that using an (non-persistent) Entity is the (Mendix) way to go, and data generation this may be done via OQL in a microflow.

Adding filtering and sorting functionality in a more generic way via microflows as data source would be nice though.