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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Retrieving and saving last sequence number

Hi,
I'm using Talend's sequence number and pass following value to the column:
Numeric.sequence("Last_Sequence_Fact05",1,1) .
How do I pass the value to variable Last_Sequence_Fact05 ?
Thanks
C
Labels (2)
3 Replies
Anonymous
Not applicable
Author

The only way is to save the last number and in the next job start you have to setup the sequence with Numeric.sequence("Last_Sequence_Fact05", context.lastNumber, 1)
But I would use a database sequence instead of job local memory sequence!
Anonymous
Not applicable
Author

thanks for your suggestion, but my main problem is not saving the value since I can retrieve it by SQL statement
I'm quite new to Talend so my problem is that I don't know how to pass a result of query:
SELECT max(qequence_num) from Fact05
to the column:
Numeric.sequence("Last_Sequence_Fact05",1,1) .
In general it is getting a value from a query and passing it to variable that could be used in other parts of the job.
c.
Anonymous
Not applicable
Author

hi,
Last_Sequence_Fact05 is the name of your sequence
use globalMap to store(put) value and get it later.
syntax
(Integer)globalMap.get("your_key_name")

so in your tMap it could be something like
Numeric.sequence("Last_Sequence_Fact05",(Integer)globalMap.get("your_key_name"),1)

Ps : with Mysql you've got tMysqlLastInserId
regards