Subreport json datasource expression using main report parameter

0

Hi all,

I've been strruggling a while with this now. I have a main report with a parameter that I need to use in the subreport datasource expression. I need it to be a json datasource.

I can't find a way to do this.

Thanks in advance :)

 

pierre.ortalo's picture
Joined: Aug 16 2017 - 1:34am
Last seen: 1 year 5 months ago

Please post some sample JRXML files for us to work with.

narcism - 2 years 3 months ago

please post source code, s that we can use also.

sushobhan.b - 2 months 3 weeks ago

2 Answers:

1

Got it :)

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 :)

pierre.ortalo's picture
Joined: Aug 16 2017 - 1:34am
Last seen: 1 year 5 months ago
0

How to pass usernam eand password along with url if i have basic authentication on URL

sushobhan.b's picture
Joined: Aug 22 2018 - 10:52pm
Last seen: 3 weeks 5 days ago
Feedback
randomness