As per the documentation, you need to put a jrDataSource into the request as an
attribute. If you need to pass parameters to your report then you would also
need to put a jrParameters into the request.
Whether you are using java or beanshell you need to put the following into
request:
request.setAttribute("jrDataSource", jrDataSource);
request.setAttribute("jrParameters", jrParameters);
How I do it java:
...........
// pass parameters to report
Map jrParameters = new HashMap();
jrParameters.put("author", userLoginId);
// in this case, i'm trying to pass list of projects to my jasper report
JRDataSource jrDataSource = null;
if(projects != null && projects.size() > 0) {
// i'm using JRMapCollectionDataSource
jrDataSource = new JRMapCollectionDataSource(projects);
}
request.setAttribute("jrDataSource", jrDataSource);
request.setAttribute("jrParameters", jrParameters);
You may also want to check out the following code to give you better
understanding:
1. JasperReportsPdfViewHandler.java
2. JREntityListIteratorDataSource.java
3. JRMapCollectionDataSource.java
Regards,
Mathius Allo
----- Original Message ----
From: Ravi Subramanian <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, January 18, 2008 1:32:56 PM
Subject: Re: Deploy custom jasperreports in ofbiz
I have not prepared the data. There is a query in the JRXML and i
thought it gets executed and the data is retreived.
Now i checked on the document
http://www.opentaps.org/docs/index.php/Using_JasperReports_with_opentaps
and it says I need to prepare the data using a beanshell script. I
looked at some of the reports in the order application and i couldnt
make out what the code does. Can u please help me by providing some
documentation on how to populate the data using the beanshell script or
with java.
Thanks,
Ravi.
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping