Created nested loop, need to come out of the nested loop to the header when a specifuc condition is met else remain in the nested loop

  1. Created a header loop which load all invouce header info in application like inv num, supplier, total amount.
  2. Created line loop, nested, since one invoice header can have multiple line items.
    Item number, unit price quantity is loaded.
    So example one invoice #100 can have lines:
    Line1 Laptop
    Line2 mouse
    Line3 keyboard
  3. While loading line info, some error in line level data, so it should cancel the entire invoice, move to next invoice header loading, else if all fine, it should load all lines of that invoice.
  4. How do i come out of the nested loop ?

@Mallika Use if condition to check the condition to go out from inner loop.
If condition is True then use Break, it takes you to main loop and header loop will continue with next invoice.

1 Like