By: Tony Hanratty - thanratty
Using $V variables in the report query string
2006-04-10 04:23
Judging by the compile errors I get, am I right in thinking that a $P parameter cannot be massaged into a $V variable which is then used in the report query string?
If that's the case - is there any way of doing some intermediate manipulation of a $P before plugging it into the query string?
Cheers,
Tony.
By: Teodor Danciu - teodord
RE: Using $V variables in the report query st
2006-04-10 07:10
Hi,
You can do that by using the default value
expression of an additional parameter for which
you do not supply a value at runtime.
I hope this helps,
Teodor
By: Tony Hanratty - thanratty
RE: Using $V variables in the report query st
2006-04-10 09:10
Thanks for the info
:-)
Using $V variables in the report query string
2006-04-10 04:23
Judging by the compile errors I get, am I right in thinking that a $P parameter cannot be massaged into a $V variable which is then used in the report query string?
If that's the case - is there any way of doing some intermediate manipulation of a $P before plugging it into the query string?
Cheers,
Tony.
By: Teodor Danciu - teodord
RE: Using $V variables in the report query st
2006-04-10 07:10
Hi,
You can do that by using the default value
expression of an additional parameter for which
you do not supply a value at runtime.
I hope this helps,
Teodor
By: Tony Hanratty - thanratty
RE: Using $V variables in the report query st
2006-04-10 09:10
Thanks for the info
:-)
2 Answers:
Posted on August 8, 2007 at 5:29pm
Hi Everyone,
I'm trying to put a $V{} in a query to make a conditional query like this:
select * from table1 where $V{con} <> 1
but it gave me the SQL executing error (syntax error).
so i made a $P{} and let the default value = $V{con},
now there is no compile error, but there is no value in $P{}, it always null. Anybody has idea about this?
Thanks in advance.
Kelly
I'm trying to put a $V{} in a query to make a conditional query like this:
select * from table1 where $V{con} <> 1
but it gave me the SQL executing error (syntax error).
so i made a $P{} and let the default value = $V{con},
now there is no compile error, but there is no value in $P{}, it always null. Anybody has idea about this?
Thanks in advance.
Kelly
Posted on August 8, 2007 at 6:24pm
kelly wrote:
Trying creating two parameters.. eg
$P{conEval} = the evaluating parameter Integer
$P{con} = passed in value (eg string "fish")
in your $P{conEval} parameter in the evaluation expression put in something like:
Hi Everyone, I'm trying to put a $V{} in a query to make a conditional query like this: select * from table1 where $V{con} <> 1 but it gave me the SQL executing error (syntax error). so i made a $P{} and let the default value = $V{con}, now there is no compile error, but there is no value in $P{}, it always null. Anybody has idea about this? Thanks in advance. Kelly |
Trying creating two parameters.. eg
$P{conEval} = the evaluating parameter Integer
$P{con} = passed in value (eg string "fish")
in your $P{conEval} parameter in the evaluation expression put in something like:
Code: |
<br /> "burger".equals($P{con}) ? new Integer(1): new Integer(0)<br /> </td></tr></tbody></table><br /> <br /> and in your query put:<br /> <table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre><br /> select * from table1 where $P{conEval} <> 1<br /> </td></tr></tbody></table><br /> <br /> This way if you pass in a String as your $P{con} variable it will evaluate in the other parameter to determine if it equals "burger" and if so replace the value in the query with the proper parameter (which checks if it is not equal to 1).<br /> <br /> You might have to escape the paramater $P{conEval} with the $P!{} syntax so that it doesn't surround the variable with '' quotes in your sql..<br /> <br /> Thanks,<br /> Jamie |