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

How I create a parameter $P{} where the expression is $p{}==1?$p{}=26:$p{}=0


adrianzazugmail.com

Recommended Posts

Hi, I created a report with ireport 5.6 , this is by compatibility with java 7 and DBF. I try to do the folow:

my query is:

Select *

from table

where field_in_table = $p{parameter_name}

I need the folow:  $p{}==1?$p{}=26:$p{}=0
 (IF(parmeter==1) true value parameter =26, false value parameter=0)

I tryed writed in default  value expression of the parameter and there is a error, i writed:
 $p{}==1?$p{}=26:$p{}=01?26:0 and not run the report,
too 1?26:0 run the report but no filter in the query sql.
I tryed with $p{}.intValue==1?26:0
and with $p{}.intValue==1?$p{}.intValue=26:$p{}.intValue=0 there is error.
How can I make the parameter change its value so that it is filtered by the expression WHERE of the query in sql.
Thank.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

u cant add logic in parameter default expression, coz default expression will be overwritten by the time user give an input.
try to add logic into ur SQL instead :

select *
from [table_name]
where [column_name] =  (case when $P{param_name} = 1 then 26 else 0 end)

u can put the logic to variable. but i hvnt tried adding variable to the SQL.
regards, TV

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