Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
abhi90
Creator II
Creator II

Incremental Surrogate Key

We have an column in Database which is Primary Key. We want to load this using Numeric.sequence(s1,1,1) But problem is in 2nd Run the value of column will start again from 1. How to start it after the last Value generated in Last Run. 

Labels (1)
  • v6.x

7 Replies
Anonymous
Not applicable

Try to get the max value of the primary key column from that table at the start of the job, Store it in a variable and then increment it for each record. 

 

abhi90
Creator II
Creator II
Author

Let's Say I am taking Max(column) in toraclerow at the start of the Job.So in tmap is it should be like Numeric.sequence(s1,Max(Column),1)?

Anonymous
Not applicable

Yes Abhi.

Anonymous
Not applicable

Hi @manishrnjn  how can we store int value in Context Variable.

can you please explain, bcaz am getting an error if i declare variable as int.

PFA screenshot


Capture.PNG
Capture_1.PNG
Anonymous
Not applicable

Hi,

 

   Currently you are storing the data of Context variable from same variable.0683p000009M31b.png

 

This will create issue. Could you please read the data from database and assign it to context variable through a tjavarow.

 

tDBInput->tJavarow

 

context.variable=input_row.max_value;

 

In this way, the data will be loaded to context variable. After that, you can assign this context variable within sequence.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable

Hi @nthampi 

I tried it but am getting the same error.

Can you please explain in detail.

Anonymous
Not applicable

Hi,

 

   Could you please share the new job flow screen shots after change along with context tab screenshot for reference?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂