Looping Script won't leave sub-loop?
I am trying to create a script that will create new records in a related table based on the number of 'credits' each record has in the initial table.
Initial Table: Members (one layout, Enter_Members)
- Field: id
- Field: cardNumber
- Field: credits
Related Table: Entries (one layout, Enter_Entries)
- Field: id
- Field: id_member
Members::id is related to Entries:id_member
Following is the script...
Go to Layout ["Enter_Members" (Members)] Show All Records Sort Records [Restore; No dialog] (sorted by 'credits') Go to Record/Request/Page [First] Loop Set Variable [$Credits; Value:Members::credits] Set Variable [$MemberID; Value:Members::id] Loop Go to Layout ["Enter_Entries" (Entries)] If [$Credits > 0] New Record/Request Set Field [Entries::id_member; $MemberID] Commit Records/Requests  Set Variable [$Credits; Value:$Credits - 1] End If End Loop Go to Layout [original layout] Go to Record/Request/Page [Next; Exit after last] End Loop
For some reason the script runs through the sub-loop successfully (it creates one new record in 'Entries' for the number of credits in the first 'Members' record) but then gets stuck after that and appears to not go to the next record in the 'Members' layout . The way I was figuring this, when the sub-loop 'End Loop' occurs, the Goto Layout and Goto Next Record should fire and start the sub-loop over again, but for the next 'Members' record. Obviously, I have a flaw in my thinking.
Any ideas or observations about what I might have done wrong would be greatly appreciated. Thanks.