Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Baris1601965481
Contributor
Contributor

How can I make a job parametric?

Hi,

I am new in Talend.

I want to give date parameter to job.

I want to use like this.

select * from SOURCE_TABLE_1 

where DATE > $PARAMETER

It will be the same job but ıt will run after the selected date.

Thank you.

3 Replies
manodwhb
Champion II
Champion II

@Barış Emeli​ , you can use the context variable concept and please check the below link.

 

https://help.talend.com/reader/U5lNkhUnaW6RdpL8qxP61w/d0QVvShdlGcIqowdsla3lw

 

 

Thanks,

Manohar

 

DataTeam1
Creator
Creator

@Barış Emeli​ you can use context as @Manohar B​ mentioned and in the query you can use it like here:

"select * from SOURCE_TABLE_1 

where DATE > " + context.DATE_PARAMETER

 

but it is very important to understand that you have to prepare the date in format which will be understandable for your database so the best way is to have context.DATE_PARAMETER set as string (not as date) and in the query you should convert it to date in proper way (depend on database requirement).

For example if you use Oracle and you want to use date as string "2020-10-07" you should use:

"select * from SOURCE_TABLE_1 

where DATE > TO_DATE(" + context.DATE_PARAMETER + ", 'YYYY-MM-DD')"

Baris1601965481
Contributor
Contributor
Author

Thank you for your warning. We use Oracle. I will consider your suggestion.