hot to get the SubReportz name

0
Hi
I loaded a jasperFile and got an object JasperReport in Java.

which methods shall I use to get the subReports names ?

Thanks
simonet's picture
33
Joined: Oct 24 2007 - 6:26am
Last seen: 11 years 11 months ago

5 Answers:

0
You'll have to better explain what you meant by subreport names.

Subreport elements in a JasperReport object have source expressions (JRExpression instances). It's not clear how would one be able to extract a "subreport name" from an arbitrary source expression.

Regards,
Lucian
lucianc's picture
7091
Joined: Jul 17 2006 - 1:10am
Last seen: 1 week 5 days ago
0
Well
I have jasper Files stored in a database, I do not know which are the reports and subreports.
I only know the name of a report.

From another site I download the jasper file which is the main Report by my software using the HttpClient and the GetMethod. I make a JRLoader.loadObject(its bytes) and cast into a JasperReport. Can I go up the subreport name by using JasperReport methods ?

Because I ask myself, how can IReport fill its report with its subReports..... with its library ?!?!? then jasperreport JAR has not library which allow to get SubReports name from a jasper...

Thanks advancetly !!!
simonet's picture
33
Joined: Oct 24 2007 - 6:26am
Last seen: 11 years 11 months ago
0
Infact I cant find methods from JasperReport class which return a SourceExpression....
simonet's picture
33
Joined: Oct 24 2007 - 6:26am
Last seen: 11 years 11 months ago
0
To be honest, I find your questions very confusing, so maybe I should let others answer them.

Still, some notes that would maybe help.

Subreport elements in a report have a "source" expression which is used at fill time to produce the actual subreport template (i.e. JasperReport object).

If you take a look at a JRXML, you'll see <subreportExpression> tags inside subreport elements. From the API point of view, a subreport element is an instance of JRSubreport and you can inspect its source expression via the getExpression() method.

To find subreport elements in a JasperReport, you'd have to iterate on all the elements of each band.

Going back now to your requirement of resolving subreports which are located in a database, this is usually done by writing a classloader that knows how to access the database and using such a classloader as value for the REPORT_CLASS_LOADER built-in parameter.

Regards,
Lucian
lucianc's picture
7091
Joined: Jul 17 2006 - 1:10am
Last seen: 1 week 5 days ago
0
GREAT !!!
Thank you very much

Regards
74B10 simonet
simonet's picture
33
Joined: Oct 24 2007 - 6:26am
Last seen: 11 years 11 months ago
Feedback
randomness