July 2, 200223 yr Okay - Loops should be simple - why do they get the best of me. Go to Layout (invoice entry) Go to Record (first) Loop Duplicate Record Go to Record (next, exit after last) End Loop I will add the other stuff later - I am just trying to get my base loop to work first. It pulls the first record and then is done - what am I missing. Thanks for your help
July 2, 200223 yr Probably because after the duplicate, you are on the "new" and now "last" record. If your list is unsorted, the new (duplicate) record appears at the end. If it is sorted, it appears after the record you just duplicated. I would try: Go to Layout (invoice entry) Sort(restore) Go to Record (first) Loop Duplicate Record Omit Record If (Status(CurrentRecordNumber) = Status(CurrentFoundCount) Duplicate Record Exit Loop If (1) End If End Loop The extra duplicate is needed to make sure the last records is duplicated. The omit operation automatically moves you to the next record to be duplicated. You can try all the operations manually to verify what is happening. -bd
July 2, 200223 yr Author This scenario that you offered - seems to duplicate twice. Once at the beginning of the loop and then once in the If statement. That won't work. Other ideas? Thanks.
July 2, 200223 yr This is not too clean but works. Go to Layout [ Your layout ] Sort [ Sort Order: Your Sort (Ascending) ] [ Restore sort order, No dialog ] Go to Record/Request/Page [ First ] Loop Duplicate Record/Request Omit Record Go to Record/Request/Page [ First ] Omit Record Exit Loop If [ Status( CurrentFoundCount) = 0 ] End Loop
July 2, 200223 yr Author Thanks - That seemed to work. Sure I will have other questions coming up. Tweety
July 2, 200223 yr Well, if you want to duplicate all records of a found set, here's a simpler solution - why not just export them to a file, import the file with new primary keys, and dump teh exported file?
July 8, 200223 yr Newbies Just a thought, if you want to keep all of the records visible using the omit procedure will obviously not work. In all of my tables (files) I create two global fields one named counter (numeric) the other named number, my loop would go like this... set field["counter", "1"] set field["number", "Status(CurrentRecordCount)"] Show all records Loop Exit Loop if ["counter=number + 1"] Go to record ["counter"] Duplicate Record set field["counter", "counter+1"] End Loop set field["counter",""""] set field["number_of_records",""""] It might seem clumsy but it works
July 8, 200223 yr Not so (I can tell you didn't try it!). The last duplicate in the "If" is needed to make sure the last record is duplicated. If you leave it out, you will only duplicate n-1 records. -bd
Create an account or sign in to comment