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: 
Anonymous
Not applicable

Bug while generating a Surrogate key for Incremental Load.

Hi,

I have a job in which i am loading two tables, in those tables i am generating Surrogate id,

 

The process which I am generating this is, before running the job I am taking the max value of that column into a context and using this context for incrementing by 1 for each row.

Here the bug which I found is that, Suppose I am loading the 1st job after that i am using onsubjobOk to start the second job.

in this case the context value of 1st job itself is taking by 2nd job as well, instead of taking its own context value.

Can anyone help me how to avoid this situation.

 

Quick help is appreciated.

 

Regards

ShaX

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Issue is resolved

Thank you

View solution in original post

24 Replies
Anonymous
Not applicable
Author

Hi,

 

    Could you please mark where you are updating the context variable in the attached screenshot? Component screenshots will be helpful to understand your flow better .

 

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
Author

Hi @nthampi ,

 

Thanks for the reply, PFA images below.

 

 

0683p000009M6c1.pngThis is the job0683p000009M6I5.pngHere am taking the max value of the column n storing it in the context.0683p000009M6NK.pngThat context am using to populate the column.

 

Please help me on this.

 

Regards

ShaX

Anonymous
Not applicable
Author

Hi,

 

    Since you are using assignment to context, could you please use tjavarow instead of tMap?

 

     Please also print the context variable before and after to confirm that the value is changing using System.out.println(context.variable_name)

 

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
Author

Hi @nthampi ,

 

As told by you, instead of Tmap, i took Tjavarow to assign value to the context.

However this method also didn't work.

PFA screenshot for your reference.

0683p000009M6d9.png

Can you help me on this.

 

Regards

ShaX

Anonymous
Not applicable
Author

Hi,

 

   Could you please share the component screenshot along with print output?

 

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
Author

Hi @nthampi,

 

0683p000009M6dE.png

 

0683p000009M65q.png 

 

This is how I am  loading the tables using contex.

Anonymous
Not applicable
Author

Hi,

 

    That is fine. But where are you verifying the current value of the context variable?

 

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
Author

Hi @nthampi ,

My issue is resolved,

what is did is, if  i am loading 10 tables in 1 job, earlier i used to use "S1" in all table in numeric sequence, but now am using from "S1" to "S10" for tables respectively.

 

I don't know weather this is the correct approach, but it is working fine as of now.

 

Regards

Shax.

Anonymous
Not applicable
Author

Hi @nthampi ,

 

Am facing same issue again after 2 days of job run.

Can you help me what can be done.

Here you can see am printing the value.

0683p000009M6lh.png

The problem is coming while loading all tables in bulk.

Is there any other way to assign a context and use where i can avoid this issue.

Currently am assigning  "context.TEST = row1.KEY" and using "Numeric.sequence("s2",context.TEST,1) "

 

regards

ShaX.