Get filter conditions in the screen controller

Hello

I need to get the filter conditions in the controller screen as a jpql query, because I need these conditions for a service.

Someone can help me?

Regards

Hi,

I think you can use “load delegate” method for your purposes from here: Data Loaders - CUBA Platform. Developer’s Manual

Loaders can delegate actual loading to a function which can be provided using the setLoadDelegate() method or declaratively using the @Install annotation in the screen controller, for example:

Loader delegate method accepts LoadContext as parameter. LoadContext contains JPQL query and parameters. In delegate method you can implement your custom logic how to load data based on query.

2 Likes

Hi Alex,

Thanks for the reply, but I can’t update the cuba version until attachable add-on upgrade. I’m using cuba platform 6.10.9 version.

Well, in this case you can create your own subclass of the CollectionDatasourceImpl class.
Then override the com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl#loadData method.
Copy most of logic from it. Replace just this line with your own logic:

final Collection entities = dataSupplier.loadList(context);