0

I am using iReports to generate some reports in my project .

I am using this line to fill the report with the parameters

JasperPrint jasperPrint=JasperFillManager.fillReport(jasperReport,paramMap,conn);

where jasperReport is an Object of JasperReport and I have a Map object paramMap which has a key names conditionals that carry the condition statement which I want to append in the query written in jasper Report.

Without condition the query is working fine in the reports

Select * from myTable WHERE 1=1

My condition carry multiple filter and I checked its generating properly fine and I append it to my query and run in my db enviornment properly.

The query which I use to add condition gives me a little bit of confusion.I add like this in report

SELECT * FROM MYTABLE WHERE 1=1 $P{conditionals}

I am not sure when this condition will executed and how to put this to run everytime.

Alex K
  • 22,315
  • 19
  • 108
  • 236
s_k_t
  • 689
  • 1
  • 15
  • 36
  • 1
    Possible duplicate of [JasperReports: Passing parameters to query](http://stackoverflow.com/questions/11871042/jasperreports-passing-parameters-to-query) – Petter Friberg Oct 30 '15 at 17:02
  • $P{conditionals} try to use prepared statement if you like string sost. use $P!{conditionals} – Petter Friberg Oct 30 '15 at 17:03
  • @PetterFriberg I have seen that and for my case I am adding one parameter conditionals in my MAP object and passing to fillReport functiona as paramMap . This map contains a string and I want to add this String to my JasperReport query . Th filters are coming from another applications. Hope you have understand my problem. – s_k_t Oct 30 '15 at 19:16
  • Not really, in query (select) either you use string substitution or you use prepared statement since $P{conditionals} is not a query value your only choice is string substition $P!{conditionals} – Petter Friberg Oct 31 '15 at 19:13

0 Answers0