Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correct use $X in jasper??. Problem with parameters and IN clause in JSS

I have a report made with Jaspersoft Studio and in the dataset query I need to use an IN clause, for that I am using the expression "$X{IN ..."

Question # 1: What is the correct type to use for the parameter? I'm using the following format: enter image description here

Question # 2: How do I test in the preview? Parameters screen:

enter image description here

To help, follow the excerpt of where with the parameter being used:

"...Where (($X{IN, db.empresa, paramIdEmpresa}) OR $ P!{ParamIdEmpresa} IS NULL) and (db_view ... "

Error that appears in the preview with the above parameters:

net.sf.jasperreports.engine.JRException: Error executing SQL statement
for: unit1. at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport
(ReportController.java:551) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access
 (BaseFillHandle.java:135) at java.lang.Thread.run (Thread.java:748)
 Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at
 or near "["   Position: 199 at
 org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
 (QueryExecutorImpl.java:2440) at
 org.postgresql.core.v3.QueryExecutorImpl.processResults
like image 328
Alison Ribeiro Avatar asked Nov 18 '25 06:11

Alison Ribeiro


1 Answers

the problem was in the query and not in jasper...

the correct query is:

where 
    (($X{IN,db.idempresa, paramIdEmpresa}) OR db.idempresa IS NULL ) 

thanks to GP...

like image 58
Alison Ribeiro Avatar answered Nov 21 '25 10:11

Alison Ribeiro