I have to save invoices in a program from an excel file. Invoices can have 1 or more items. If there are multiple items, I have several excel rows with the same invoice number.
I have made an activity FOR EACH to read each invoice and in the body I need a loop. As long as the invoice number is the same, the items must be recorded within the same invoice.
I can’t get the while loop to work properly.
Maybe someone knows how to fix it. Thank you!!
Use FOR EACH check if Invoice variable empty or not. If empty, assign current iterating invoice to Invoice variable. If not empty, Check if Invoice variable is same as current iteration invoice. If same record as same invoice else assign current iterating invoice to Invoice variable
There’s no need for a while loop. You just need a variable that keeps track of the previous invoice number and then compare it with the current invoice number in the For Each Row loop.
Thank you very much, you are right, this is the best way to solve my problem. Just one thing, the first row compares with the table header. Is there any way to recognize that it is the first row?
@ROSARIO_JIMENEZ_MARTINEZ while reading the excel with Read Range checkbox the property AddHeaders this will add first row as header and while iterating it will not iterate. Only data rows will be iterated.