2005 IR Help Posted August 24, 2006 Share Posted August 24, 2006 By: sathya - postsathya subreports with API 2004-03-15 20:17 pls somebody help i need to build a report with a subreport how to pass the parameters and expressions to the subreports through the master I dont know how to start with the problem Thanks in advance Sathya By: srini - kapsljava RE: subreports with API 2004-03-15 20:32 Hi, see the sample programs and xml. u will get the idea of how they r passing the parameters. tell me whether u r using the table data source or database connection. From srinivas By: sathya - postsathya RE: subreports with API 2004-03-15 20:40 Thanks for ur reply srinivas I was about to use the table datasource now I ve started to fetch data in two tablemodels that are to be passed to the master report and subreport respectively I dont know how to interconnect the subreport with tbe main report shall i use the JRDesignSubreports class here? if it is so where could i pass this object to the mainreport. my snippets are TableModel model = fetcher.fetchData(); JRDataSource dataSrc = new JRTableModelDataSource(model); JasperPrint print = JasperFillManager.fillReport(jasp,null,dataSrc); now where cud i say about the subreports here pls help me out Thanks and regards sathya By: sathya - postsathya RE: subreports with API- help me out 2004-03-15 21:48 how could i do it somebody there help me out Thanks in advance By: David Lim - aberrant80 RE: subreports with API 2004-03-15 21:55 You don't need to specify the subreport when filling. Just make sure your main report has a subreport expression that points to the subreport and a data source expression to pass the data source in. By: sathya - postsathya RE: subreports with API 2004-03-15 22:02 Thanks David Cld i ve any example snippets By: David Lim - aberrant80 RE: subreports with API 2004-03-15 22:07 1. Create instance of JRDesignSubreport 2. Use setExpression to set the <subreportExpression> part of the XML. 3. Use setDataSourceExpression to set the <dataSourceExpression> part of the XML. 4. Set whatever else attributes you want. 5. Add it to a band on the main report. Look up the quick reference on what those expressions are for and do some tests. You'll learn better through error. By: sathya - postsathya RE: subreports with API 2004-03-15 22:30 1. Create instance of JRDesignSubreport --> JRDesignSubreport subreport = new JRDesignSubreport(); JRDesignSubreportParameter subParam = new JRDesignSubreportParameter(); subParam.setName("Resourceid"); JRDesignExpression exp = new JRDesignExpression(); exp.addFieldChunk("RESOURCEID"); subParam.setExpression(exp); // add the parameters to the subreport subreport.addParameter(subParam); IS THE FIRST STEP OK?? 2. Use setExpression to set the <subreportExpression> part of the XML.--> subreport.setExpression(JRExpression); 3. Use setDataSourceExpression to set the <dataSourceExpression> part of the XML.--> exp = new JRDesignExpression(); exp.addParameterChunk("REPORT_DATASOURCE"); // add it to the subreport subreport.setDataSourceExpression(exp); IS IT RIGHT??? IF IS WRONG HOW TO SET THE EXPRESSION? 4. Set whatever else attributes you want. ?? 5. Add it to a band on the main report. ?? David , THANKS FOR SPENDING UR VALUABLE TIME FOR ME DAVID Now i want to know whether i was in a right track it is so, then how could i define the expression using JRDesignExpression, it contains something chunks, setid set Name ,setText ,... methods culd u pls help me out in resolving these things and to define my expression Thanks David By: srini - kapsljava RE: subreports with API 2004-03-16 21:58 Hi David, is the code is working correctly or throwing exception.. From srinivas By: sathya - postsathya RE: subreports with API 2004-03-17 03:23 yeah it doesnot accepts the expression for the subreportdatasource and was not even successfully compiled........throws exception Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now