how to pass parameter with entity list to native SQL query?

Hi!
I need help.
How to pass list ID of Entities to SQL native query passed from external parameter (type Entity list)?

And second question. How to extend timeout of execution report? I have long queries in report and when executing long report sometime have connection loss.

Hi,

How to pass list ID of Entities to SQL native query passed from the external parameter (type Entity list)?
You can use “Entity List” parameter alias in the SQL query. For example:

SELECT u.LOGIN as LOGIN FROM SEC_USER u WHERE u.id in ${entities}

where entities alias of the “Entity List” parameter. See also report in the attachment.

I have long queries in the report and when executing long report sometimes have connection loss.
You can run the report as a background task. The connection won’t be lost in this case. See [url=https://doc.cuba-platform.com/reporting-6.6/run_cancel.html]https://doc.cuba-platform.com/reporting-6.6/run_cancel.html[/url]

Report for entity -User-.zip (8.4K)

Andrey, I have error

Unable to convert between com.haulmont.cuba.core.entity.IdProxy and JAVA_OBJECT

To solve such error for one entity - I need to convert parameter by Groovy script

return [[ 'brandid': (params['brand'].id.intValue()) ]]

But I dont know how to convert this for list of entities. :wink:

Andrey, I’ve solved
written groovy script

def shops = []
shoplist = params['shoplist']

shoplist.each { 
    shop -> shops.push(shop.id.intValue())
    
    };


return [[ 'shops': shops ]]

I have other question, background task works on 6.4 platform version?

1 Like

Hi,

Background tasks for reporting work on the 6.4.

About error:

Unable to convert between com.haulmont.cuba.core.entity.IdProxy and JAVA_OBJECT
We have created YouTrack issue and we’ll try to fix it.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-9528