I have an excel with some 5 columns (say ID number, Name, branch, Date, description) in it and a table in an application .
In the application > I have a table which has values (say ID number, Date, Description) , Need to choose a value in a table by scrolling down and save it. I have to read the values in excel and for each record i have to select the value in the scroll down and select the appropriate value to save the record. (for eg, First record has ID num 001, and date : 02/21/2018… I have to go to application-> there will be values in the table like ID num 001 , 02/21/2018 and 002 , 01/30/2018 and 005 ,02/ 21/2018 etc.
I stored all values from excel in a datatable and while iterating → for each record have to choose the correct combination from the table and select the value and save it.
Your approach looks good. but I think you still improve it by doing the comparison without iterating in a for each loop.
You already have the excel sheet data in a datatable. Let’s extract the data in the application table to another datatable variable so that you have two datatables to deal with… Now, without iterating, you can directly use datatable Join functions to retrieve only the record that matches.
In the result will be a set of matching records of the two datatables. Now, you can directly use it to save the values you need. Iterating in this loop is much efficient. don’t you think?
@Lahiru.Fernando - Thanks for your response, I decided to use iteration… because, In the application → I have to enter the ID number and Name to populate the table first. and for each record, the table and values will be different. forgot to mention in my query though… Btw, the join data table is a separate learning though, which cannot be used in my sitation