Hi all
I am getting data from excel sheet and i need to validate that data that is present in the existing table or not
If the particular data is not present or if there is any spelling mistake we have to throw an error of that particular word
For example:
Reference table data: {india, usa, Australia,uk}
Excel data:{india, usa, Australi}
Here Australia spelling is wrong we have to display that the perticular Australi is not present
How can i do this any idea guys
Discussion posts and replies are publicly visible
a!localVariables( local!checkExcelItemsInRefTable: a!forEach( items: ri!excelArray, expression: contains( { ri!refTablearray }, fv!item ) ), /*Match each index of array to return a boolean array if match was found or not*/ local!notFoundIndexes: wherecontains( false, local!checkExcelItemsInRefTable ), /*Indexes from excel array where the match wasn't found*/ concat( joinarray( index( ri!excelArray, { local!notFoundIndexes }, {} ), ", " ), " not found in reference table" )/*Returning the message with the values not found in reference table*/ )
Use a code like this to compare arrays and get the following result.
Hope it helps!
Regards,
Kunal
a!localVariables( local!referenceTableData: { "india", "usa", "Australia", "uk" }, local!excelData: { "india", "usa", "Australi", "Iran" }, local!notPresentList: a!forEach( items: local!excelData, expression: if( contains( local!referenceTableData, fv!item ), {}, fv!item ) ), concat( a!forEach( items: local!notPresentList, expression: if( fv!isLast, fv!item, concat( fv!item, "," ) ) ), " is not present in data" ) )
Hi Nikkheel,
You can use simple built in Appian function.
difference({"india", "usa", "Australi"}, {"india", "usa", "Australia","uk"})
Thank you its working