Ireport - Sub report with same main datasource

Asked

Viewed 705 times

1

I’m developing a relatório and it has a subrelatorio that must have the same DATA SOURCE of relatório main, for this the dataSourceExpression of subreport was as follows:

<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>

The problem is that this way the subreport no more rendering on relatório.

I’m using the iReport 6.1.0

  • I think you should be mixing the concepts, not to say never, rarely you should pass the parent report datasource to the son report. What are you trying to do in iReport ? Print a nested list in your report ?

  • No, what I’m doing is segmenting my report, because it has header and footer regions that should only be printed in front of a condition, so so that I don’t need to condition all the fields I decided to put them inside a subreport and condition the subreport.

  • see if this post meets you: http://answall.com/questions/32955/createreports-nested listings. If you don’t answer, edit your question and put the structure of your main report object (if you’re working with objects and not xml or sql). Another detail, the Jrdatasource is practically an Iterable, where who iterates it is the Java himself. How are you trying to pass the REPORT_DATA_SOURCE to a child report, at least once the method. next() has already been triggered and you would not be able to see the first element (this at least until the Jasper 4).

  • Thank you for your help, but I solved it in a way that seems more correct. Instead of using subreport for this I ended up using a "frame" to encapsulate the fields and put the condition in this ""frame". So I don’t need the subreports anymore. Thanks anyway for the north!!

1 answer

1


As the first comment of wryel I was using a wrong concept, doing the right way I removed the subreport and in its place to encapsulate the fields I used the component "frame", so I do not need to condition all the fields but only the "frame"".

It worked perfectly, in addition to optimizing the report.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.