I see. I would create one array for detail band you want, ie one for Schools, one for Hospitals, etc. The Arrays should either be of JavaBeans or of Maps. If you use JavaBeans, follow the naming conventions in the Beans specs to expose specified fields in the beans. If you use a Map, each entry consists of a key that is the field name and the value.
When you have your array, wrap it in either a JRMapArrayDataSource or a JRBeanArrayDataSource. Both of these objects implement the JRDataSource interface, and can be used as the source of data. When you include the subreports be sure to specify a dataSourceExpression that evaluates to the correct object.
-Barry On Dec 7, 2005, at 3:50 AM, neqo seppuku wrote: at that time, what should be the subreportParameterExpression let me explain how I take the data to my masterreport from java, I have created a list and object array, and these objects to list, and send this list to the report. let say there are 3 fields in the master report: Object[] obj = new Object[3] and in for loop list.add(obj); that puts the data in report. now does an Object can take a list of data, and in connection _expression_ can I use $F instead of $P ? thanks...
On 12/6/05, Barry Klawans <[EMAIL PROTECTED]> wrote: Hmm, I'd say that depends on the amount of data in each sub report. You could pull out the data in your code and convert it into an array of beans, and pass those to the subreports to use as a data source.
-Barry On Dec 5, 2005, at 12:17 AM, neqo seppuku wrote: in the subreport, there should not be sql query, I want to passes all fields to subreport with datasource, how can I do this ? does subreportParameter has to be only one value, how can I pass more than one parameters to subreport ? thanks...
On 12/3/05, Barry Klawans < [EMAIL PROTECTED]> wrote: Create a subreport for Schools and a subreport for Hospitals. A subreport is basically a report that can be placed inside another report. You author it just like any other report, but don't set the page size to be bigger than you need for editing. Then create a new report, place both subreports inside it, and you are done. Take a look at the "subreport" sample include in the distribution.
-Barry On Dec 2, 2005, at 5:21 AM, neqo seppuku wrote: hi all, I need to design my report with two details band, like this, there sholud be two parts in the report that dynamically grow :for example : SCHOOLS school name school id location school1 1 city1 school2 2 city2 ...... HOSPITALS hospital address phone #of doctors hospital1 adres1 1 5 hospital2 adres2 2 6 ........ these two information parts should include in the same report, the number of records are dynamic, so how can I solve this problem. is it possible to do this in jasperreports? thanks...
|