amypaulsmom Posted July 2, 2002 Posted July 2, 2002 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
LiveOak Posted July 2, 2002 Posted July 2, 2002 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
amypaulsmom Posted July 2, 2002 Author Posted July 2, 2002 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.
bobsmith Posted July 2, 2002 Posted July 2, 2002 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
amypaulsmom Posted July 2, 2002 Author Posted July 2, 2002 Thanks - That seemed to work. Sure I will have other questions coming up. Tweety
keshalyi Posted July 2, 2002 Posted July 2, 2002 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?
Newbies lamemeister Posted July 8, 2002 Newbies Posted July 8, 2002 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
LiveOak Posted July 8, 2002 Posted July 8, 2002 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
Recommended Posts
This topic is 8178 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now