AnsweredAssumed Answered

Nested loops on same table

Question asked by lannycook on Feb 14, 2012
Latest reply on Feb 15, 2012 by philmodjunk


Nested loops on same table


HI all,

I am trying to loop through parent records in a table that finds the childred for each parent and then loops through those.  What I have tried results in losing the first cursor on the parent records and dropping out after the first parent.  I am assuming that the cause is that both cursors are based on the same table.

Go to Layout ["Item_List" (Item)]

Perform Find [ Specified Find Requests: Find Records; Criteria: Item:: Default_Flag: "Yes"] [Restore]  {returns 9 rows}

Go to Record/Request/Page [First]


     Go to Related Record [ From Table: "Item"; Using Layout: "Item_Children" (Item) ] [Show only related records]  {returns 2 rows}


           Go to Record/Request/Page [Next; Exit after last]

     End Loop

     Go to Layout [ "Item_List" (Item) ]  {show only the 2 rows from Item_Children layout}

     Go to Record/Request/Page [Next; Exit after last]  {since above cursor was already on the last row this exits loop}

End Loop


What is a good way to do this? 

Thanks for your help.  Lanny