Numeric.sequence per Job

Highlighted
One Star

Numeric.sequence per Job

Hi,
my JobA calls JobB via a tRunJob.
Within JobB, I've got a tJava where I call Numeric.sequence.
Unfortunately Numeric.sequence starts only the first time I call JobB with 1. But I want it to start from 1 everytime I call JobB.
From JobA I call tRunJob (JobB) via a OnComponentOK (because it's a tJava which calls tRunJob) - is this ok?
Within JobB I use:
id = Numeric.sequence ("s1", 1, 1);

(but it's in a routine and get's called from the tJava)
Is it somehow possible to reset id after JobB finished?
I found this: http://www.talendforge.org/forum/viewtopic.php?id=3429 but I have a subJob, do I have to do it like this, too?
Thank you in advanced.
Bye, Chris
One Star

Re: Numeric.sequence per Job

Hi,
You can use the process id in the sequence name :
id = Numeric.sequence(pid, 1, 1);

It's explained here : http://www.talendforge.org/bugs/view.php?id=5665
Best regards,
Karine
One Star

Re: Numeric.sequence per Job

Hi Karine,
thank you for your reply.
Got it working now Smiley Happy

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch