Jump to content

Single Select Query with parameters


silvannos

Recommended Posts

Hi,

I am using iReport 3.5.0 and I have a report with single select query input control. I would like to have parameters in this query but when I try to do it, I get this error:         net.sf.jasperreports.engine.JRRuntimeException: Parameter "test" does not exist.

Is there a way to do this?

Thanks!

Simon

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Do you mean the name of the Input Control itself or the name of the Query inside it (once I click on "Edit Local Resource")?

**Edit:

In case I haven't explained clearly what I want to do, here are some more details.

I have a report with a query that takes a two parameters: $P!{locale} which has a value of e if the locale is english and a value of f if it is french, and $P{client} which has an input control. This input control is named client and is of type single select query. In that query, I need to use the same parameter $P!{locale} as well but it does not seem to be working.

I should maybe also add that doing a preview in iReport runs the report without any errors.



Post Edited by silvannos at 01/22/2010 19:44
Link to comment
Share on other sites

The Parameter and the input control need to have the same name: in this case it seems to be 'client'.

 

I am not entirely sure if you need the locale paremeter as the JRXML has a parameter REPORT_LOCALE which is filled by the environment, such as iReport or JasperServer.

 

the syntax using the ! is only if you are injecting code into the report query.

 

please share the querystring, parameter definition and details about the input control.

Link to comment
Share on other sites

Here is the query found in the input control:

SELECT srch_ownr_cd AS code, nvl(srch_ownr_altnt_nm_$P!{locale}, SRCH_OWNR_NM_$P!{locale}) AS name FROM srch_ownr_cd_tbl where srch_ownr_dspl_ind = 1 ORDER BY srch_ownr_nm_$P!{locale}

My locale parameter is of class string and has a Default Value Expression of: (""+$P{REPORT_LOCALE}).equals("fr")?"f":"e"

The input control is of type Single Select Query, as I have said before. I have checked mandatory and visible. The Value Column is code and the Visible Query Column is name.

If you need anything else, ask me and I will provide it.

Thanks for all your 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...