We are using jaspersoft studio to create a report and i am stuck at query part. Logically the kind of query i want is :
select * from mytable where
IF (condition1)
raw_sql_part_1
ELSE
raw_sql_part_2
So now to achive this in "Query editor dialog", i wrote:
select * from mytable where $P!{param1}
and added "param1" default value in Expression editor as:
"$P{param2}.equals("A") ? "1 <> 1" :"1=1" , is 'For prompting' as false
Also added "param2" in parameter list with 'is for prompting' as true
I expect this: When i hit preview it will prompt me for param2 value and then based on param2 resolve the condition in param1 and then finally substitute that in the actual query. The default value of the param2 is empty string.
What actually happens: when i hit preview it ask me for the value of param2 which is expected,but value of param2 is not used to resolve condition defined in param1 as param1 condition always resolved to else part i.e "1==1" and the main query also became
select * from mytable where 1==1
Q1: Am i expecting wrong ?
Q2: Why is param2 is not used to resolve condition defined in param1 ?
We are using Jaspersoft studio version 6.1.1