One Star

Numeric sequence reset

Hello,
i am using a variable inside a tMap like this ---> Numeric.sequence("s1",1,1) * 10
so for each record processed i get 10, 20 ,30 and so on
the problem is that i need to reset this sequence each time i launch the job...
when launching the job from inside talend, the sequence is correctly resetted but if i export my job as
webservice, the sequence never resets.
is it possible to resolve this problem? Thanks in advance.
11 REPLIES
One Star

Re: Numeric sequence reset

can anyone help?
One Star

Re: Numeric sequence reset

up
Employee

Re: Numeric sequence reset

I suggest you to add a feature to improve it.
Yet, you can duplicate Numeric routine and add a method such as:
    public static void resetSequence(String seqName, int startValue) {
seq_Hash.put(seqName, startValue);
}
One Star

Re: Numeric sequence reset

thanks a lot, it worked!
i created a new Routine, i copied Numeric routine code and i added this method:
public static void resetSequence(String seqName){
seq_Hash.put(seqName, 0);
}
Then i call the method from a tava component. Thanks again for your answer
Employee

Re: Numeric sequence reset

Please create a feature to improve the product even this method works, it will improve the product for the next release, thank you.
One Star

Re: Numeric sequence reset

When I try to install this routine, the "seq_Hash.put(seqName, 0);" part get's red-underlined. seq_Hash in particullar.. Any ideas why my TIS 3.2 doesn't have that Java class? Is there any particullar class I need to import on the top of the routine package??
Help would be much appreciated.
One Star

Re: Numeric sequence reset

You should copy sequence related code from Numeric system routine, add new method and use your routine instead of system.
Five Stars

Re: Numeric sequence reset

This may be an old post, but it saved my days of work. Thanks to all that contribute back to the forum.
One Star

Re: Numeric sequence reset

There's a function to do this now.
Nine Stars

Re: Numeric sequence reset

Do you want to help people by posting the function?
One Star

Re: Numeric sequence reset

It's in the Numeric system routine at 5.6.2