Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
It's a data problem, not a job design problem. If you don't have data in the file that you can match to data in the DB to identify the record then there's no way to do an update.
Yes, you've just repeated what you said before so I'm just going to repeat what I said before: the only way to update the DB is if the file has data that you can use to find the record in the DB that you want to update i.e. the file data matches the DB data.
So explain what your file data schema is, what your DB data schema is, which fields in the file will be used to update the DB and which fields will match data already in the DB (if it's not a new record)?
So is the Salary the only data that should be updated? Can you say for sure that the Names (or Name and Age combinations) are unique and won't need to be changed?
OK, so we can take Name and Course as fixed values i.e. use those to look for the record in the table.
But what you want is complicated because of the need to use the parent's ID as a foreign-key when you do an insert but the parent might already exist or you might only be creating it now. I think the best way is to do the parent and child in separate steps.
First, read your file with just Name and Age in the schema, making Name the key field. Pass the flow to tUniqRow to eliminate the duplicates and then to your parent DB table. In the DB output component, set the "Action on data" to "Update or Insert". Now existing Names in the DB will be updated with the new Age and new Names will be inserted (with Age) and the ID generated by the DB.
As the second step, read your file again as the main flow to tMap with a lookup flow from the parent table, joined on Name. In the output, make NAME_ID and Course the key fields with Amount as the other field. In the DB output component, set the "Action on data" to "Update or Insert". Now existing NAME_ID and Course combinations in the DB will be updated with the new Amount and new NAME_ID and Course combinations will be inserted (with Amount) and the ID generated by the DB.
Without seeing your job, I can't determine what the problem is. But I don't think it's possible to do everything you want in one.