2006 IR Open Dicussion Posted August 27, 2006 Posted August 27, 2006 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 :-)
kelly Posted August 9, 2007 Posted August 9, 2007 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} <> 1but 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
jmaher Posted August 9, 2007 Posted August 9, 2007 kelly wrote: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} <> 1but 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:"burger".equals($P{con}) ? new Integer(1): new Integer(0) and in your query put:Code:[code]select * from table1 where $P{conEval} <> 1 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). 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.. Thanks,Jamie
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now