Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Print multiple reports, chosen by multiple parameters
ag1234567890
<p>Hello,</p>
<p> </p>
<p>I've created a report, the first one we are going to use with our Magento extension so we are not yet into Birt Reports and its functions.</p>
<p>I googled during the last days but I did not find a good solution that works.</p>
<p> </p>
<p>My specific report is an invoice and the report is being selected by our Magento extension. We enter a parameter on start which selects the stuff for our report.</p>
<p>The report works without a problem.</p>
<p>But now my customers asked for a way to batch print reports, which means they want to start the report, enter multiple parameters (seperated by ","), and multiple birt reports should be shown. A page for each.</p>
<p> </p>
<p>I hope you understand it. I found the request a bit weird, but understandable if you want to quickly print many invoices of course.</p>
<p> </p>
<p>I've already tried some stuff, such as setting my parameter as dynamic list box to select more than one but as a newb to it, I cant find a solution.</p>
<p>Anyone got an idea or an example report?</p>
<p> </p>
<p>Thanks</p>
<p> </p>
<p>ps: my birt version is up2date</p>
Find more posts tagged with
Comments
Clement Wong
<p>Welcome to the BIRT community. With BIRT, there's always more than one way to do things.</p>
<p> </p>
<p>I'm not familiar with your Magento extension, but from what I understand from the requirements, there should just be a few simple modifications to your report design, depending on your design/data source.</p>
<p> </p>
<p>The "before" attached example is the included SalesInvoice example included in the OS BIRT Designer (<em>Window > Show View > Other... > Report and Chart Design > Report Examples > Solution Reports > Business Forms</em>).</p>
<p> </p>
<p>The "after" attached example illustrates one option so that multiple order numbers as a comma separated list generates each invoice on a separate page.</p>
<p> </p>
<p>Modifications made:</p>
<p>1. Changed the report parameter type (was a Decimal) to String.</p>
<p> </p>
<p>2. Changed the Data Set SQL query clause from:</p>
<pre class="_prettyXprint">
AND CLASSICMODELS.ORDERS.ORDERNUMBER = ?</pre>
<p>To:</p>
<pre class="_prettyXprint">
AND CLASSICMODELS.ORDERS.ORDERNUMBER = 10100</pre>
<p>as a place holder. You'll change the beforeOpen event later to make it dynamic in Step 4.</p>
<p> </p>
<p>3. Deleted the Parameter "OrderNumber" from the Data Set.</p>
<p> </p>
<p>4. Select the Data Set's Script. Add the following in the beforeOpen event:</p>
<pre class="_prettyXprint">
inClause = "CLASSICMODELS.ORDERS.ORDERNUMBER IN ( " + params["OrderNumber"].value + ") ";
this.queryText = this.queryText.replace("CLASSICMODELS.ORDERS.ORDERNUMBER = 10100", inClause);</pre>
<p>5. Drag the Data Set (Invoice Data in my example) out</p>
<p> </p>
<p>6. Select ORDERNUMBER as the column to display/bind</p>
<p> </p>
<p>7. Create a new Group in the table. Group on "ORDERNUMBER". Change the<em> Page break > After: </em>from <em>Auto </em>to <em>Always Excluding last</em>.</p>
<p> </p>
<p>8. Delete any child report items that Step 5 may have created in the table such as the ORDERNUMBER label and Data Item.</p>
<p> </p>
<p>9. Drag the contents of the existing report into the Group header.</p>
<p> </p>
<p>10. Select on the Table and add a new Filter</p>
<pre class="_prettyXprint">
row["ORDERNUMBER"] Equal To row._outer["ORDERNUMBER"]</pre>
<p>If you run the report, you'll see two pages (with the default parameter), one for each order number.</p>
<p> </p>
ag1234567890
<p>Hey,</p>
<p> </p>
<p>thanks for that quick answer and in such a detail! Helps a lot. I'm still trying to figure out how to properly work with Birt Report. It's quite a nice tool with many possiblities.</p>
<p> </p>
<p>Thank you!</p>
ag1234567890
<p>Okay,</p>
<p> </p>
<p>I've followed your steps and created a new report by that, I've done every step and checked with the other report you've uploaded.</p>
<p>Now the report works, I can start it after I uploaded it to Magento. I added a ceckfield for the report ID on the report and once it runs it shows the correct ID.</p>
<p>A second page with the second report works as well, it just always shows both invoice items on both pages and it only shows values of the first invoice.</p>
<p> </p>
<p>The table for invoice items and invoice values is at the Detail row and in the Group Footer Row in the inner table. The address at top that works correctly in both first and second report is in the header group row of the inner table. If I was putting stuff in the top, it always works so I guess my inner table is still not working correctly.</p>
<p> </p>
<p>I've uploaded my rptdesign. Without database stuff (SQL still there of course!) as you cant address it from outside of our LAN anyway. I'm not sure if it helps you??</p>
<p> </p>
<p>I highly appreciate any answer!</p>
<p> </p>
<p>Wish you a nice weekend.</p>
Clement Wong
<p>Since I am not able to run your report from my end, I changed the Data Source to the Classic Models sample database and made aliases for the column names you have in your database. There were just a "few" to aliases to add.</p>
<p> </p>
<p>After I ran the report, and it shows up as expected. Two pages, each order on its own page.</p>
<p> </p>
<p>I did not make any structural changes to the report. Only three changes were made: The Data Source (switched to Classic Models db) and Data Set (changed SQL and commented beforeOpen code).</p>
<p> </p>
<p>I ran this on a few versions of OS BIRT (4.4.2 for example) and commercial BIRT (iHub 3.1) and same expected result. What version are you using?</p>
<p> </p>
<p>The data returned by your SQL statement should not make a difference because the outer table is filtering out each order.</p>
<p> </p>
<p>If you can replicate the behavior you are seeing with Classic Models and let me know what type (OS or Commercial) and version of BIRT you are running, I can take a look further next week.</p>
ag1234567890
<p>I really have to thank you. I've just tried what you described and it worked perfectly fine with that replacement. That obviously means the mistakes is on my side, and it is indeed. It is quite weird, but I'm really happy it was my mistake.</p>
<p>First my SQL Query was wrong, it gave me both order items for one invoice order... and later I've also noticed I used the wrong entity_id in my SQL as well.</p>
<p> </p>
<p>Then after trying for some hours, my report was broken as well, didnt create any ResultSet but that wasnt the point tho.</p>
<p> </p>
<p>Thanks a lot...</p>
Clement Wong
<p>Good to hear that it is now working!</p>