Jump to content

Report Parameter as List


florian.weihl
Go to solution Solved by florian.weihl,

Recommended Posts

Hi there,
I'm currently facing the issus that I cannot send my defined list parameter via REST query.
The report displays only the parameter values and I call the report with this request:  http://localhost:8080/jasperserver/rest_v2/reports/reports/PARAMETRERTEST.html?PARAMETER_TYPES=26117&PARAMETER_TYPES=26118
The requests works fine, but the report wont display my passed list items.

My list is currently not filled with any values, since it will be depentend on another input field. If this is possible, which I don't know.

Can someone help me with this issue?
Thanks in advance
 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

I am not fully understanding your question, but I would like to comment on something that has been bothering me.

I was wondering why the parameter property 'Nested Type Name' is not set.
I wonder if this is something that can be omitted?
w20210811_parameter.png.5a8aec2ef0b7309a6e9328e5cad346b4.png

I hope this is helpful.

 

Link to comment
Share on other sites

Hi,

thanks for the quick response.
I set the nested type to be an integer, but that didn't work.

Let me try to explain it a little bit diffrent.

I defined my list list this <parameter name="PARAMETER_TYPES" class="java.util.List" nestedType="java.lang.Integer"/> It does not have any defined list items, since I want them to be dynamic (depending on the value of another parameter).

If I define entries for my list, then it works like a charm and I can make the REST call without any problems.
But I want the list to be able to accept any values.

Best regards

 

Link to comment
Share on other sites

I noticed one more thing.

It may be because you have not defined the values to be displayed in the input control list for the parameter 'PARAMETER_TYPES'.

For example, if the following URL is accessed, I think it will not work unless '26117' and '26118' are present as values in the input control list.

http://localhost:8080/jasperserver/rest_v2/reports/reports/PARAMETRERTEST.html?PARAMETER_TYPES=26117&PARAMETER_TYPES=26118[/code]


Therefore, if you specify 'any value', I think all of the assumed 'any values' must appear in the list beforehand.


I hope this is helpful.

Link to comment
Share on other sites

  • Solution

I saw that one too, but this only set's the values, in a predefined list, as selected.
However I figured out how I can change the list items.

Each report has, apperently, its own resources and for list parameters which are defined like in the picture below, then jasper generates invisible files for them.
These files can be accessed via the following request
http://<<Jasper-IP>>/jasperserver/rest_v2/resources/reports/<<REPORT_NAME>>_files/<<PARAMETER_NAME>>_files/<<PARAMETER_NAME>>
Within the header the parameter "Content-Type" needs to be set to "application/repository.listOfValues+json" or "application/repository.listOfValues+xml"

With the PUT - method a body like this

{
    "label": "lov_<<PARAMETER_NAME>>",
    "version": 0, 
    "type": 6,
    "items": [
        {"label": "test3", "value": "25626"}
    ]
}

you can change the values of the list parameter :)

BUT the version number must be the same as the one from the the jasperserver. Each time you change at least one list properties the jasperserver increments this version number by 1.
 

Thank you so much for your time and help :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...