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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to prevent duplicate records from inserting

HI,

I have a csv file which gives me source to target mapping. 

ex: 

source;month;status;target
AB1;01;A;A01
AB2;02;B;B02
AB2;02;C;C02

For every unique value for source,month& status, target value is given.

Since this file is manually updated. I want to write a logic that in case of  same(duplicate) entries inserted for these 3 columns, the file should get rejected. how do i do it.?

 

 

pic.png

This is how my job looks..? tfileinput is my input csv file. in Tmap, i just uppercase all the fields.

So if duplicate entries are inserted in csv file.my file should be rejected.. Thanks in advance!

Labels (3)
3 Replies
TRF
Champion II
Champion II

Add a tUniqRow after the tFileInputDelimited then you can check the value of the variable tUniqRow_1_NB_DUPLICATES.
I suggest you to add a tJava connected to the tFileInputDelimited by a onSubjobOk trigger. Don't change anything to this component and connect it to a tFileDelete with If trigger with the following condition (Integer)globalMap.get("tUniqRow_1_NB_DUPLICATES") > 0
Anonymous
Not applicable
Author

Hi @TRF, thanks for the reply.

 

I dont to delete the file in case a duplicate is found. I just want the load to output to get error out.

 

also, can u pls do dummy job to let me know how it is done.? I'm not sure if i m doing right, as it is not populating results.

 

The java component gives me a msg - if the output has components , then there must b input link to propagate data.

pic.png

TRF
Champion II
Champion II

1- you forgot the tUniqRow to get duplicate records

2- you have used a tJavaRow instead of a tJava