Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to have a sequence for one of the column and it should start the sequence from where the last run stopped.
for example if 10 was generated by sequence for first run , for second run it should start with 11.
I got the first half , to generate the sequence using numeric.sequnce("s1",1,1)
can you suggest how can i implement the second part , i went through the forum but couldn't find the solution
Thanks in advance,
lmit
Thanks @lmit .Please accpect solution.
Hi lmit,
Please do following steps.
1) Create context parameter sequence_max_value.
2) Get Max value of sequence column.
example : SELECT max(sequence_column) AS sequence_max_value FROM table_name;
In tJavaRow check if query returns null then assign context.sequence_max_value=1 other wise context.sequence_max_value=input_row.sequence_max_value(This is max value from table);
3) In the tmap use numeric.sequnce("s1",context.sequence_max_value,1) expression.
Note : If you want you can also use ISNULL function in query and assign value 1.
in this senario,store your first run max sequnce value in file or Database,before the main you from the input file/database load seq num into context ,and the in tmap,use sequnce funation givet the current value is context value.
Hi,
Thanks Manohar & Ravi for your reply.
Am not using DB,Its flat file --- so how can i get the max value
@ manohar can i know how can i store the max value.can you please provide some screenshoots that would be great help.
Thanks,
lmit
you were generating sequence in Var of tmap right,you just pass to one extra optput section and use the tAggregaterow componet to get the Max Values of your sequence.
hi Manohar,
I got the value in tAggregaterow but i got stucked after that how should i produce further
Thansk,
limt
affter tAggregaterow ,use tfileoutputdelimtter and load that value into file.
Hi manohar,
I stored the value in file.when i want to store the value in the context, should i store in local or global variable , if so then how.
Thanks,
lmit
read the same file and loaded into context using tContextload in the main flow of same job,where you are generating the sequence in tmap
Thanks Manohar , will try this option.
Thanks once again
Thanks,
lmit