Hi
I need advice.
Read CSV file and want to find duplicate value.
if there are duplicate values .I want to display error msg..
I was able to load the CSV and remap it to the map list, but I was unable to check for duplicates values and unable to add error msg.
Image like the attached image
Discussion posts and replies are publicly visible
Could you elaborate more on what you are trying to do? Are you looking for duplicates on "No" and/or "col1" and/or "col2"? What are you expecting in error1/2/3? What does your current expression rule look like, and what have you tried for finding the duplicate values that is giving you difficulty?
Dan Lluhi
At first i want to read csv file and then check csv file data. I'm looking for duplicate value on [No] column.
if there are duplicate value on [No] column. i want to add error msg and sent it back csv file with error message.
If there are no duplicate value register to DB.
Please find the below code. Made a sample code for your understanding. More efficient and simpler code can be created.
a!localVariables( local!doc: ri!doc, local!data: readexcelsheetpaging( excelDocument: ri!doc, sheetNumber: 0, pagingInfo: a!pagingInfo(startIndex: 2, batchSize: 5000) ).data.values, local!formatData: a!forEach( items: local!data, expression: if( a!isNullOrEmpty(fv!item[2]), {}, a!map( name: fv!item[2], gender: fv!item[3], department: fv!item[4], tech: fv!item[5] ) ) ), local!duplicateCheck: a!forEach( items: local!formatData, expression: a!update( data: fv!item, index: "error", value: if( length( wherecontains( fv!item.name, local!formatData.name ) )>1, "Duplicate Values Found", "" ) ) ), local!duplicateCheck )
Konduru Chaitanya
Really helpful for me. I understand and work for me!!!
Thank you so much for your help
I have another question, I would like to create a CSV file with the current results.
How can i get it more efficiently.
If the answer works please do verify the answers which helped you.
yes.I made it