Problem with Report Book tutorial "Parameter "country" does not exist."

0

I'm using TIBCO Jaspersoft® Studio 6.8.0 - Visual Designer for JasperReports 6.8.0. 

I'm working through this tutorial

https://community.jaspersoft.com/wiki/report-books-jaspersoft-studio

When I enter the query in the section "Creating a Report Part for the Detail Section", it fails with this exception:

net.sf.jasperreports.engine.JRRuntimeException: Parameter "country" does not exist.

The query is: select * from orders where shipcountry = $P{country} order by shipcity

The exception is correct; the tutorial does not define the 'country' parameter until close to the end, but I can't get past this point due to the exception.

So how did the tutorial author get past this point without getting an exception?

Thanks,

Tom

 

valeskyt's picture
Joined: Jul 25 2018 - 9:11am
Last seen: 4 days 20 hours ago

3 Answers:

0

Hi Tom

You are correct since you are following the instructions verbatim. The sentence "You will create the proper "country" parameter in this report." should be before creating the dataset query otherwise I can't see how you can overcome the error. Apart from that everything else looks pretty detailed and should accomplish the main aim of the article. 

 

 

vchiem's picture
4138
Joined: May 1 2017 - 5:33pm
Last seen: 4 hours 16 min ago
0

Is there a way to create a parameter within the report creation wizard? 
 

What's the standard practice for creating a report that uses parameters in query? Do you just skip the query portion of the wizard, then create the parameters, then do the query in the "dataset and query" tool, then drag all the fields onto the report? 

Or do you just start out with the query without parameters, and add them later once you're done with the wizard and have the initial form created?

valeskyt's picture
Joined: Jul 25 2018 - 9:11am
Last seen: 4 days 20 hours ago
0

There is no formal standard practice for report development as you can approach it either way as long as you know that by creating a query in a dataset with a parameter, there must exist a parameter defined. If the query is created first with a parameter, it will obviously error with parameter does not exist but the parameter can be created afterwards and then go back to the dataset query to verify it without needing to write the query again. However, if the parameter is included initially you cannot preview the resultset of the query written, so you can write a query that doesn't include any parameters first to preview the result and then include the parameter afterwards..after it being defined and then injected into the SQL.  

vchiem's picture
4138
Joined: May 1 2017 - 5:33pm
Last seen: 4 hours 16 min ago
Feedback
randomness