Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to schedule a report with collection type parameter via REST API in JasperReports Server?

I'm using JasperReports Server v4.5.

We are having difficulties with scheduling a report by using REST API.

We are able to schedule a report that only accepts string parameters however the problem begins with a report that has a java.util.Collection type parameter. We tried everything but couldn't find the correct type for java.util.Collection.

Right now this works:

<parameters>
    <name>string_input</name>
    <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        test
    </value>
</parameters>

But we couldn't get this working:

<parameters>
    <name>array_parameter</name>
    <value type=? >[1, 2, 3]</value>
</parameters>

When I looked into the code, I can see that JasperReports Server WS accepts arrays, however there is no documented way to send the arrays or array types.

What is the correct way to solve this issue?

like image 444
Berk Caputcu Avatar asked Nov 13 '22 08:11

Berk Caputcu


1 Answers

Give this a try:

<parameters>
    <entry>
        <key>param_name</key>
        <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="collection">
            <item xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">1</item>
            <item xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">2</item>
        </value>
    </entry>
</parameters>

Update:

Some have suggested removing the entry tags. If the above does not work, try removing the entry tags.

like image 200
Artem Kalinchuk Avatar answered Nov 15 '22 13:11

Artem Kalinchuk