How to create drop down parameter in Jaspersoft studio

Hi,

I want to create a parameter of type drop down using jaspersoft studio 6.2.0 (I am not using JasperServer) and populate data in this drop down from a JSON file. Based on the value selected in drop down paramter my report will be displayed.

Example: I have a JSON file which has data related to students. Suppose there is details of 100 students. Now I want to create a drop down parameter which will be populated with student name from the JSON file and on selecting any student from the drop down, details of that student should be generated.

sample JSON:

[{
"ID": 1,
"Name": "Arun",
"Phone": 123564,
"Branch": "ECE"
}, {
"ID": 2,
"Name": "Praveen",
"Phone": 147852,
"Branch": "CSE"
}, {
"ID": 3,
"Name": "Amla",
"Phone": 15987456,
"Branch": "EEE"
}]
 
Please help me in creating drop down parameter.
 
Thanks,
Rajiv
 
 
rajivranjanmaurya's picture
Joined: Dec 7 2015 - 10:50pm
Last seen: 7 years 9 months ago

I am having the same issue, but my data is coming from db table instead of json.
Check if this might give u a hint: http://stackoverflow.com/questions/33819990/get-list-of-values-lov-from-...

zuhayer171288 - 7 years 9 months ago

2 Answers:

Since you are not using Jasperserver is up to you to create your select box from the JSON file, there are tons of Javascript UI libraries that will enable to do that.

JasperReports just needs the parameter to be passed it does not have any influence on how you handle the display of that to your user.

For more infor on using parameters look into: http://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-us...

 

marianol's picture
17616
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 11 months ago

If you want to have a drop down list in Jaspersoft Studio, just create a parameter with datatype java.util.List.

If you set the report language to Groovy, you'll be able to set something like ["First", "Second"]. You'll need to convert your JSON to List.

hozawa's picture
190315
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 years 3 months ago
Feedback
randomness