One Star

Reg: How to pass a filter condition as variable in Input/row component

Hi,
I am having a Date filter condition in a query. The value supposed to be retrieved from a file and passed to the query. Is there any why to do it in talend.
version: Talend 3.1
Input Component: tOracleInput with the following Sql
Sql: Select * from Table_Name where Day_id >
Output component: tnetezzaOutput
Thanks in Advance,
Arun
2 REPLIES
Community Manager

Re: Reg: How to pass a filter condition as variable in Input/row component

Hello
Yes, you can pass a date to the sql query dynamically. Your job looks like
tFileInputDelimited-->tJavaRow-->tFlowToIterate-->tOracleInput-->tnetezzaOutput
tFileInputDelimited: get date value from a file
tJavaRow: format the date and set the value to a context var
tOracleInput: "select * from table_name where day_id >'"+context.date+"'"
about tFlowToIterate component, see 5827

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Reg: How to pass a filter condition as variable in Input/row component

Shong,
I Just Enabled Implicit Context option in the Job->Extra. And Set the file location which has the date values need to be passed. Now everything is Working fine. The script inside the toracleInput is same as what you replied.
Thanks a Lot,
Arun