Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
/**
* return an incremented numeric id
*
* {talendTypes} int | Integer
*
* {Category} Numeric
*
* {param} string("s1") sequence identifier
*
* {param} int(1) start value
*
* {param} int(1) step
*
* {example} sequence("s1", 1, 1) # 1, 2, 3, ...
*
* {example} sequence("s2", 100, -2) # 100, 98, 96, ...
*
*/
public static Integer sequence(String seqName, int startValue, int step) {
if (seq_Hash.containsKey(seqName)) {
seq_Hash.put(seqName, seq_Hash.get(seqName) + step);
return seq_Hash.get(seqName);
} else {
seq_Hash.put(seqName, startValue);
return startValue;
}
}
Morning Rhall_2_0. the link you provided below is a dead link. Do you have one that works? I'd like to see the solution that you provided. I'm almost there but not quite...I'm trying to do:
partition data by Field1
order the data within partition by Field2
get the row_num()
thanks
Brad