[resolved] Batch file modification

One Star

[resolved] Batch file modification

I have designed a job to copy data from excel file to the sql tables. Now I want to export this job and modify it to more user friendly.
I have used 7 context variables in my job. Now I want to modify my batch file in a way that I can run it using another batch file which has values for these context variables.
My genrated batch file may contain something like.. -context_param ExcelFileLocation=%1 --context_param Host=%2 --context_param Database=%3 --context_param Schema=%4 --context_param Username=%5 --context_param Password=%6 --context_param StoredProcedure=%7 %* It is to mention the order of context variables.
And my another job file may have something like.. JobName "FileLocation" "ServerName" "SchemaName" "DatabaseName" "Username" "Password" "StoredProcedureName"
I would execute this second file and my job will be executed using context variables mentioned in it. This current syntax is not working. Kindly suggest me the way to do this.

Accepted Solutions
One Star

Re: [resolved] Batch file modification

I got it working.
Main file, named 'job1.bat' has..
... --context_param contextvar1=%1 --context_param contextvar1=%2 --context_param contextvar1=%3
Another file has..
job1.bat value1 value2 value3

All Replies
Moderator

Re: [resolved] Batch file modification

Hi,
Is this document TalendHelpCenter:How to change context parameters in Jobs helpful for you?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Batch file modification

Hi Sabrina,
No it did not help much.
I could definitely do this to apply specific context variable values. But it has a complex syntax which I don't want user to remember.
I want to edit my batch file in such a way that user can call it using another batch file by just mentioning the original job file and context variable values.
I want to specify the order of context variables in my original batch file. My another batch file will call this file with its own context variable values in that specified order.
Another batch file's text should look like
"OriginalBatchFileName ValueOfContextVariable1 ValueOfContextVariable2 ValueOfContextVariable3 ValueOfContextVariable4 ValueOfContextVariable5 ValueOfContextVariable6 ValueOfContextVariable7"
So that I would have to change only context variable values in my another batch file, to run it with different context variables.
- Yuvraj
Employee

Re: [resolved] Batch file modification

Hi,
Our Talend Platform offering will definitely suit your need.
In our commercial solution; we promote a Job Scheduler out of the box which allow you through a user friendly Web UI to manage your JOBS, the Schedule of those and everything related to Context Variable.
Management of the context Variables just prior a run etc...
Our Talend Platform for DataServices flavor can even be better for you; you would expose/deploy your Job as a DataServices SOAP or REST Job; then you can create a Quick and Dirty WebUI with your context parameter FIELD to your users; and they will just have to fill it and submit the FORM; then it's a basic WebService call and the fields from your webpage become the context variable and/or the PayLoad of your Webservice.
You're facing one limitation of Talend Open Studio which is focus on delivering a Studio for development but not the full equipment for managing Deployment and Execution which is the purpose of our Talend Platform offering.
Best regards;
One Star

Re: [resolved] Batch file modification

Actually I remember modifying one batch file to perform such task.
But I can't recall it. As far as I remember it could be done using Talend Open Studio.
I am just not sure about my syntax.
Its ok if I have to modify mu second batch file to provide different context variable values.
One Star

Re: [resolved] Batch file modification

My generated batch file is job1.bat
At the end of it I have removed --context=default and have added..
--context_param Database=%1 %*
now I have another batch file Test3.bat which has it texts as...
job1.bat Test3
Where Test3 is the name of the database with which I want to work.
But its not working.
What do I need to change in these two files?
One Star

Re: [resolved] Batch file modification

I got it working.
Main file, named 'job1.bat' has..
... --context_param contextvar1=%1 --context_param contextvar1=%2 --context_param contextvar1=%3
Another file has..
job1.bat value1 value2 value3