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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Update field values based on Update or insert status

Hi,
This "probably" is not a Talend DI issue but I am not able to figure out how to do it so I am asking here.
I have to copy data from 1 database table to another. In the destination table there are 2 fields created_date and updated_date.
The value in these fields is to be populated, as the name suggests, when the record is created and updated respectively.
So when loading a record from the source into the destination I need to check (based on the destination's primary key) if the record already exists in the destination or not. If it does not then I need to set the value of the created_date field. If the record exists (id is already present) then I need to set the value of the updated_date field and keep the original value of the created_date field.
Now my problem is how and where do I make this check and set the appropriate field's value?
Labels (2)
14 Replies
Anonymous
Not applicable
Author

Thanks Laurent.
Your approach seems to work for me.
Anonymous
Not applicable
Author

thanks to put topic as 'resolved'
regards
laurent
Anonymous
Not applicable
Author

Hi,
I have got one more question related to this. Is there a way to know how many records have been inserted or updated?
A log or a message that can be printed on the console after the job execution is completed.
Anonymous
Not applicable
Author

Yes, you have some variables linked to your tMysqlOutput component :
((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_INSERTED"))
((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_UPDATED"))
((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_DELETED"))
((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_REJECTED"))
Anonymous
Not applicable
Author

Thanks tangiobs!