You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi,
I have a set of sql-queries defined globally in my project. Many of them have an in clause like the following to filter the result set:
and p_nid in (5,6,8,9,11,13,14,15,66)
I would like to define the ids as context variable and refer them in my sql-query. Is that somehow possible?
thank you for suggestions,
regards,
Marco
Hi,
thank you very much, works like a charm.
regards, Marco
Could I do a similar thing where I use a context variable inside a context variable?
For example if I store just the where clause in a context variable:
context.where_sql = "in ("+context.id1+","+context.id2+","+context.id3+")"
Offline

can the context hold list of values?
so that way we need not to hard code/restrict the number of variables like id1, id2, ... idn
Offline

ok, in that case is there any alternate way to implement?
Offline
The only way I know is via a tFlieDelimited. The file would contain a list of variables to use:
id1
id2
id3
...
Talend would iterate through that list. Perhaps you can call those variables another way??
Offline
Hi,
Why not use a context variable named "ids" like this:
context.ids = "5,6,8,9";
And then in your query use:
"where id in (" + context.ids + ")"
I see no reason this could not work. Can you explain why you said no Pedro?
Regards,
Arno
Offline
Pages: 1