Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

Query parameter in file

Highlighted
Six Stars

Query parameter in file

hello dear all
I have a problem I would like to configure a query so that the parameters of the query are in a file on my computer.

I use a tAS400Row and the query is as follows: select * from table where date =? and name = '?'
I would like them? be read to a file on my computer.

 

plz help.

Highlighted
Moderator

Re: Query parameter in file

Read the parameters in a file and read using tfileinputdelimited and then use tflowtoiterate component after that use tAS400row and with the global variable of tflowtoiterate construct the query.
Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Sixteen Stars
Sixteen Stars

Re: Query parameter in file

Construct the query as a sting like this:

"select * from table where date = " + (String)globalMap.get("theDate") + " and name = '" + (String)globalMap.get("theName") + "'"

 

Global variables theDate and theName must be pupulated after reading the file where the values are:

tFileInputDelimited-->tFlowToIterate

For tFlowToIterate, untick the option "Use the default (key, value) in global variables"  the add 2 rows to define these variables or let the option as is and use the autogenerated names such as row1.theDate and row.theName.


TRF

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog