Archive for December 7th, 2007

Dec 07

Jasper Reports: Java Beans as DataSource for Subreports

Today I had a problem. I had a complex bean (Bean which contained other beans) which was being sent as JRBeanCollectionDataSource (JasperReports API version 2.0.2) to a Jasper Report.
This report had to have sub reports for the inner bean. I really could not find out how to pass the bean to the subreport from my main report.
Finally I cracked the nut.
What I did was set the DataSourceExpression in the Subreport element to

<datasourceexpression>
<!–[CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{taxBeanList})]]–\>
</datasourceexpression>

Where $F{taxBeanList} is a collection of Tax Beans.
In My subreport I do not have any datasource or queires. This sort of got it working.
I hope to add more to this post in future when I reread it and find some gaps.

0
comments

Dec 07

Outer Joins Vs Inner Joins

Today I looked into Outer Joins and Inner Joins. I have never used joins (Explicit) always relied on the Implicit joins created by the where clause.

In Outer Joins we have Right Outer Joins and Left Outer Joins and Full Outer Joins. What this basically means is that if there is as foll:

Left Outer Join:
All the records in the first table will be displayed even though there is no corresponding records in the second table.

Right Outer Join:
All the records in the second table will be displayed even though there is no corresponding record in the first table.

Full Outer join.
All the records of both the table will be displayed.

A Good example is given here.
Join (SQL) – Wikipedia, the free encyclopedia

0
comments