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

Re:How to use parameter in ireport


shatad0101

Recommended Posts

   Hi,

 

 

I am sharad and i m new in ireport and currently i am using ireport 4.0.0 version

and i am getting some error

Code:
Today I was trying to  use parameter in where clausesuch as-- select emp_salary,last_namefrom employeeswhere emp_id in ($p{id1},$p{id2}) but i m getting error so how tofigure out this problem plz help me Is it possible to do such a thing with iReport and JasperReport ?
Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Which error are you getting?

I had the same problem as you and I found a link saying that the sintax of SQL parameters is '$P{param}' and the sintax or iReport parameters is '$P!{param}'. Try defining your query in the following way:

select emp_salary,last_name

from employees

where emp_id in ($p!{id1},$p!{id2})

 

Hope this helps.

 

Link to comment
Share on other sites

I have defined two parameter name system_name1,system_name2 as value expression text

and default value for system_name1 is xyz and for system_name2 is abc

 

where system_name in ($P!{system1},$P{system2!})

 

error-

sourcefile inline evaluation of : ''xyz:" illegal use of undefined variable class,or void literal

Link to comment
Share on other sites

So what I understand is you have two parameters "system1_name" and "system2_name".

You set a default value for each one, as it is a string it should be between double quotes.

If the names of the parameters are system1_name and system2_name the where clause should be like follows:

where system_name in ($P!{system1_name},$P!{system2_name})

If everything is defined as specified here it should work ok. If you want you can attach the jrxml file and will check if everthing is ok.

Regards.

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