I've created the context variables below:
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,
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.
Watch the recorded webinar!
Create systems and workflow to manage clean data ingestion and data transformation.
Introduction to Talend Open Studio for Data Integration.
Test drive Talend's enterprise products.