Jump to content
We've recently updated our Privacy Statement, available here ×

passing $P{} parameters to subreport


2005 IR Help

Recommended Posts

By: Chris Cureau - ccureau

passing $P{} parameters to subreport

2005-08-24 12:00

Hi there!

 

I've got a bit of a problem when trying to pass along parameters to my subreport from the main report. This is what I have:

 

passed to the subreport:

 

optId $F{optId}

select $P{select}

 

select is passed as a parameter to the first report, and I need to pass it on to the subreport to use in the query. When I construct the query with only optId, it works fine. When I add the select parameter in as well, jasper reports that there is an error in the sql statement. I've verified that the parameter being passed is correct before being sent to the main report and that the complete query works fine in mysql's query browser.

 

The query looks something like this:

 

select a.field1, a.field2, b.field3 from table1 a, table2 b where a.field1=$P{optId} and a.field1=b.field1 $P{select}

 

Any ideas why this wouldn't work?

Link to comment
Share on other sites

  • 6 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

When naming your fields, variables, and parameters you need to avoid using reserved words. The original post had $P{SELECT}, and SELECT is a reserved word in SQL.

 

Maybe you are suffering the same problem because your parameter name is based on some reserved word that is interpreted in a manner that creates an error.

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...