How to pass dynamic parameter value to data adapter URL in jasper

0

Hi All,

I have a subreport which is populating data using json url.

for json URL i am using a data adapter and subreport is also sing same.

Below is my data adaapter file.

<?xml version="1.0" encoding="UTF-8" ?>
<jsonDataAdapter class="net.sf.jasperreports.data.json.JsonDataAdapterImpl">
    <name>Remote_JSON_Data_Adapter </name>
    <dataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:type="httpDataLocation">
        <method>GET</method>
        <url>http://xxx.com/api/v1/pricelists/</url>
        <username>techUser</username>
        <password>mDNWqaff7sRmbwqQ8m</password>
    </dataFile>
    <language>json</language>
    <useConnection>true</useConnection>
    <timeZone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:java="http://java.sun.com"
              xsi:type="java:java.lang.String">
        Asia/Calcutta
    </timeZone>
    <locale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:java="http://java.sun.com"
            xsi:type="java:java.lang.String">
        en_IN
    </locale>
    <selectExpression></selectExpression>
</jsonDataAdapter>

and in subreport using data dapter property:

<property name="net.sf.jasperreports.data.adapter" 
          value="repo:/PID/Remote_JSON_Data_Adapter"/

My question is.

how i can pass a ID to data adapter from subreport like below:

so that url can be formed like : http://xxx.com/api/v1/pricelists/{ID}.

Please help

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

1 Answer:

0

HI
have a look at this, there is note at bottom it may help
https://community.jaspersoft.com/questions/1107291/traversing-json-outpu...

I am currenly also trying to get my report to work with dynamic URL

zeldakr's picture
Joined: Oct 7 2019 - 6:20am
Last seen: 18 hours 1 min ago
Feedback