Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

Below is my query :

 

select name
(SELECT a
FROM xyz
WHERE aaa=bbb
) "Lost/Not Present/Completed "

from table1

where name in ('a','b','c')

 

I have ('a','b','c') in my context variable "names" . how should i replace it.  i tried in the sql builder using the below query

"select ...........

 ------------

 where name in "+context.names    

 

Im getting SQLSyntax exception. Is there any other way . 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

There is a further change that will be required so that the column alias does not screw up the Java String.....

 

"select name, 
(SELECT a
FROM xyz
WHERE aaa=bbb
) \"Lost/Not Present/Completed\"
from table1
where name in (" + context.names + ")"

Since the column alias is in double quotes, you need to escape these with a \. This is because the SQL is actually a Java String.

View solution in original post

6 Replies
manodwhb
Champion II
Champion II

@rathinTalend,can you try with below way.

 

 

select name
(SELECT a
FROM xyz
WHERE aaa=bbb
) "Lost/Not Present/Completed "

from table1

where name in ( +context.names+)

TRF
Champion II
Champion II

 

"select name, 
(SELECT a
FROM xyz
WHERE aaa=bbb
) "Lost/Not Present/Completed "
from table1
where name in (" + context.names + ")"

Beware of " to open and clode each part before/after the variable(s).

TRF
Champion II
Champion II

@rathinTalend, did this help?

If so, thank's to mark your case as solved (Kudos also acceptedas a bonus).

Anonymous
Not applicable
Author

There is a further change that will be required so that the column alias does not screw up the Java String.....

 

"select name, 
(SELECT a
FROM xyz
WHERE aaa=bbb
) \"Lost/Not Present/Completed\"
from table1
where name in (" + context.names + ")"

Since the column alias is in double quotes, you need to escape these with a \. This is because the SQL is actually a Java String.

Anonymous
Not applicable
Author

Did this solution work for you?

Anonymous
Not applicable
Author

 

Thanks rhall , i just found out the solution and forgot to post my answer over here. (Y) . Escape sequence did the trick