How to add unique batch ID to a job

One Star

How to add unique batch ID to a job

Hi,
I want to add an Batch_ID to my job which runs daily. But this Batch ID should be unique for each run and needs to be incremental.
I created a variable which converts my job run start date into integer and gives me output in form of "yyyyMMdd". Now I want to add a unique number in front of this "yyyyMMdd", so that it serves as a BATCH_ID for that particular run. Point to be noted is, it should add only one number in front of "yyyyMMdd" for each run of the job, and should be incremental for the subsequent runs. I hope i have written my query very clearly.
I willbe grateful if someone could help me out.
Community Manager

Re: How to add unique batch ID to a job

Hi 
If you want the batch_Id to be incremental for each run, you need to write batch_Id to somewhere such as file or database, read this batch_Id at the beginning of job, use this batch_id in the job and update it to the destination at the end of job.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to add unique batch ID to a job

Hi Shong,
This is where I am stuck. The source file does not contain any Batch_ID. I had to add two new fields while mapping using tMap and again add an additional tMap to map those two newly added fields.
I am successfull till producing a batch_id derieved from the "job run date" column, but I am unable to add a unique number in front of this  derieved column which is same for all the rows mapped for that particular run.
Thanks though. I wish someone else might have faced this issue and came out with something innovative.
Community Manager

Re: How to add unique batch ID to a job

For the first run, the source file doesn't contain any batch_id, you can initialize a default value, and then, concatenate it with the 'job run date' string.
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to add unique batch ID to a job

Thank you shong.