Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic SQL query column modification in Talend

Hello,
Similar way, I would like to change the SQL query columns dynamically in talend. I am fetching the columns values from one file and I was trying to store those values in Context Variable. So for every iteration it will choose different value and it will change the SQL column in query. Later I would like to store output file system with the name of value which we have retrieved from variable i.e. <Variable_Value>.dat

Could you please help in this use case? or Did somebody try this scenario before?

Thank you

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi @RakeshSelukar,

 

You can try below,

 

0683p000009M2OS.jpg.

 

0683p000009M2OX.jpg

 

0683p000009M2Oc.jpg

 

 

0683p000009M2Oh.jpg

 

 

Please mark the topic as resolved if my answer helped you and Kudos are also welcome.

Regards,

Vibin CT.

View solution in original post

3 Replies
akumar2301
Specialist II
Specialist II

 

can you please explain your question with input file and expected output ?

 

 

 

Anonymous
Not applicable
Author

For example:

Input file contains 

AMT1

AMT2

AMT3

 

Source Table: ABC (ID number, NAME varchar2(30), AMT1 number, AMT2, number, AMT3 number)

 

Expected query - 

1st iteration: SELECT NAME, SUM(AMT1) from ABC where ID=(...) group by NAME;

2nd iteration: SELECT NAME, SUM(AMT2) from ABC where ID=(...) group by NAME;

3rd iteration: SELECT NAME, SUM(AMT3) from ABC where ID=(...) group by NAME;

 

In the above query I want use variable instead of "AMT[1-3]" so it will pickup the values of column from lookup file and it will generate query at runtime to produce output.

 

Thank you!!!

Anonymous
Not applicable
Author

Hi @RakeshSelukar,

 

You can try below,

 

0683p000009M2OS.jpg.

 

0683p000009M2OX.jpg

 

0683p000009M2Oc.jpg

 

 

0683p000009M2Oh.jpg

 

 

Please mark the topic as resolved if my answer helped you and Kudos are also welcome.

Regards,

Vibin CT.