Jump to content

Help Parameter (Array of Integer)


fabioebner

Recommended Posts

 Can anyone tell me how i can pass one Array of Integer to my  ireport?

 

i Need to execute SELECT  * FROM table WHERE Cod in (1,2,5,63)

 

but i try to pass that (1,2,5,63) with Collection and List 

 

SELECT  * FROM table WHERE Cod in ($cods)

 

and i got:

 

1. Parameter type not supported in query : caixas class java.util.List

 

1. Parameter type not supported in query : caixas class java.util.Collection

 

:(

 

help me

tks

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

i think the best way is passing a String that contains the list you want...

so parameter is a String: "(1,2,5,63)"

and the SQL use the syntax:

SELECT  * FROM table WHERE Cod in $P!{cods}

 

(note the ! syntax)

 

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening: Placebo - Where is my mind

Link to comment
Share on other sites

 i try this, but i get that error:

 

 

Error filling print... Error executing SQL statement for : report name
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : report name 
    at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:141) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:681) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:601) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1247) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:826) 
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:59) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) 
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:858) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 
Caused by: org.postgresql.util.PSQLException: ERRO: erro de sintaxe em ou próximo a "[" 
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) 
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) 
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) 
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) 
    at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:135) 
    ... 11 more 
Print not filled. Try to use an EmptyDataSource... 

 

 



Post Edited by fabioebner at 05/28/2010 15:49
Link to comment
Share on other sites

I think you don't pass the correct value:

" erro de sintaxe em ou próximo a "[" "

it seems that you pass an array...
to use this methos you must pass a String in the "(1,2,3,4....,10)" format and use the "$P!{value}" syntax (NOTE THE !)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...