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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Get last insert ID of a specific table

Hi !
I have a sub-process with 2 simple steps :

Add a new item in the DB
Add links related to this item in a relational table in the DB

Then, I need the last insert ID.
The two steps come from the same source of data. That means I have a tReplicate with two branches : first to insert the value, second to insert the links.
For the second step, I use to put a tMySQLInput, select the content of the table (just ID and name) and match with the data I just inserted (basically, the name).
Obviously, I committed the first action before doing the second one.
But the SELECT doesn't give me the ID. Seems it doesn't get the up-to-date data of the DB.
On another sub-part of the job, I get this ID (one iteration later) and, obviously, I checked that my value is well inserted.
I tried to use the tMySQLLastInsertId component, but I still have the problem : for the same iteration, no value returned.
I used the same MySQL connection, of course.
Any idead will be appreciated !
Thank you !
Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hi,
Have you checked component t<DB>lastInserted which fetches the last inserted ID from a selected DB Connection?
TalendHelpCenter:tMysqlLastInsertId?
Could you please post your job design screenshots into forum?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi,
Yes, I tried tMySQLLastInsertID.
Actually, I had the same problem with that component.
I solved my problem by putting this component (tMySQLLastInsertID) right after the tMySQLOutput, and then I have the last ID directly, and I don't have to wait for the next iteration.
Thank you for your answer !
Anonymous
Not applicable
Author

Hi,
Thanks for your feedback and set this topic as resolved.
Best regards
Sabrina