Lords and Ladies,
I have a report that uses a parameter to get its json data:
<parameter name="net.sf.jasperreports.json.source" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["http://34.208...."&docType=" + $P{docType}]]></defaultValueExpression>
</parameter>
It works great on its own, it is autonomous ( not having a data adaptr).
However, I want to use it as a subreport. Do I need to give it a datasource ? and if so, will it cause probleme since it goes fetching one itself ? (I am passing master report parameters_map)
Thanks in advance
2 Answers:
Ok, I got it :)
So, it seems that giving a datasource to the subreport in the main report design is mandatory.
The called subreport doesn't perform it's own rest service datasource call.
In order to work I used the following datasSource expression for the subreports:
new net.sf.jasperreports.engine.data.JsonDataSource("http://34....Id=" + $P{Id}.toString(), "")
It creates a JSONDatasource object by calling its constructor and passes the url where to get the json (location argument of the constructor) , second argument is a query on returned data. A main report argument can be passed to the url as you can see.
Hope it helps anyone :)