Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a requirement of implementing Incremental load for a target table in Mysql DB.
My primary Key is a AlphaNumeric i.e W00000001,W00000002,W00000003 etc.,to achieve this i am using
Numeric.sequence("s1",1,1).toString() in tmap var section
and used the below code in output component of tmap(attaching the screenshot as well)
StringHandling.LEN(Var.V_SEQ)<8?
"W"+StringHandling.STR('0',8-StringHandling.LEN(Var.V_SEQ))+Var.V_SEQ:"W"+Var.V_SEQ
The process i have followed is to get the max of Primary Key from target table and auto increment .
To do so i have used tDBinput(Mysql) >Main>tJavarow>tlogrow(for testing purpose)
tDBinput(Mysql) = "SELECT max(KEY ) as BOOKING_KEY FROM `TableName`" and created context (attached the screenshot)
And in tjavarow i have use the below code
context.BOOKING_KEY=input_row.BOOKING_KEY;
context.BOOKING_KEY_NEXT=Integer.valueOf((context.BOOKING_KEY).replaceAll("W",""))+1;
System.out.println(context.BOOKING_KEY_NEXT);
so the input and output of the job will be W00078385 and 78386.
Here my ask from community is how this output can be used in var section of tmap Numeric.sequence("s1",1,1).toString() in the main job so that the next time the PK will start from max number of target table
Hi @manodwhb ,
As mentioned in the beginning, I would like to know how can i use the output of tjavarow in the tmap.
Posting my job design for reference.I have use the output of tjavarow which is an number in the tmap sequence definition i.e
Numeric.sequence("s1",1,1)
have 3 parameters: