Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Karuetl
Creator II
Creator II

store the dynamic values in context variable

I am beginner in Talend , So need help 

 

From the source I have ID column and I need to store the max value  of ID into the context variable and use it in the query in the source in next run like as below 

where clause as  where ID > "+context.Max_ID+" 

 

Please guide me how I can implement this

Labels (2)
4 Replies
TRF
Champion II
Champion II

Have a look to tContexDump and tContextLoad components
Karuetl
Creator II
Creator II
Author

Could you pls help me in steps

TRF
Champion II
Champion II

Suppose you have a property file which contains the last Max_ID you've queried:

Key;Value
Max_ID;100

When the job starts, you can get the content from this file to populate your Max_ID context variable using tFileInputDelimited + tContextLoad components:

0683p000009LzIu.png

Now you can use the current Max_ID value in your query where clause.

From the result, you have to retrieve the new max value to update the Max_ID variable (using a tJavaRow or something else).

Finally, use a tContextDump to dump all the context variables, tFilterRow to keep only the key "Max_ID" and tFileOutputDelimited to overwrite the initial property file with the new Max_ID value:

0683p000009LzIz.png

TRF
Champion II
Champion II

@Karuetl did this help you? If so, thank's to mark you case as Solved (Kudos also accepted)