Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to setup a Talend job to use command line parameters passed to the .bat file

Hi all,

 

I've created the context variables below:

 

0683p000009M0cn.png

 

In my tDBInput1's Query field, I have:

"SELECT Instance__c, Instance_Usage_Log_Date__c, userid, teamid
FROM teamcalllogs tcl
INNER JOIN users u ON tcl.userid = u.userid
INNER JOIN teams t ON u.teamid = t.teamid
WHERE Instance_Usage_Log_Date__c > '" + TalendDate.formatDate("yyyy-MM-dd",context.startDate) +
"' AND Instance_Usage_Log_Date__c < '" + TalendDate.formatDate("yyyy-MM-dd",context.endDate) + "' AND Instance__c <> ''
GROUP BY Instance__c, Instance_Usage_Log_Date__c
ORDER BY Instance_Usage_Log_Date__c ASC;"

 

This all seems to be working fine, as it returns the expected number of rows for the context variable default values.

 

Now what I'd like to do is have the possibility of passing the startDate and endDate as command line parameters to the bat file. How can I accomplish this?

 

Right now I'm testing this on a windows environment, but I'll be running it on as a cron job on a unix environment. Will the setup be significantly different?

 

Many thanks in advance,

 

JP

 

 

Labels (2)
1 Reply
TRF
Champion II
Champion II

You can use --context_param on the command line. For example:

--context_param startDate=whatYouWant --context_param endDate=whatYouWant

You can also have a extenal file to store some of your context variables.

See tContextLoad for details.

You can also have all context variables loaded automatically when the job starts.

See this post where I give the solution.

Hope this helps.