Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to implement Running Sequence Number(Auto increasing) like Skey from SCD component.
Presently I have used the below logic:
Numeric.sequence("row1.id",1,1)
But this always start from 1 if i run my job again, causing duplicate in Skey values. Please suggest.
@manodwhb : Thanks! I will check that.
By the way, I used the postgresqlSCD component and worked perfectly fine for my requirement! Is there any issue with this component for implementing SCD2?
@sushantk19, You can implement SCD2 with postgresqlSCD component.
@manodwhb I got a issue here. Every time i run my job, sequence again starts from 1 and not as max(row count) in table. As an eg if i have 300 records in table with above sequence logic, the next time i load the data, the sequence no should be 301 and NOT 1 which is happening now. Please suggest what needs to be done here.
@sushantk19,in your job first you should read max value from that table keep in context or global variable and then in the next flow in the same job you need to connect both using on subjob ok and then you have to use a sequence like below .
Numeric.sequence("s1",context.max_id,1)
Hi,
Sorry for the late reply again. This logic is failing and i am getting some random value as the next value.
I tested the code today again with some more data from source. My max id =10. I got a new code from the source, so this new code should be inserted with the id as 11, but i am getting sometimes as 23 or sometimes as 28. Not sure what is happening. Please note my code field is string and ID is integer.
ID= Integer
code= string.
whenever, a new code is found, it should increment the ID by 1.
Present logic is ID=Numeric.sequence("s1",context.max_id,1), but its not working and giving me a random value as 23 or 28 after 10. please suggest what is going wrong here.
@sushantk19 , can you show your screenshot of mapping?
@manodwhb : please find the screenshots attached.