Niet32 Posted February 24, 2005 Posted February 24, 2005 I want to be able to duplicate a number of found records in one of my databases. I am having trouble setting it up so that after the first record it finds the next record to duplicate. Right now it find the first record, clears the seleted info, and stops because it puts the duplicated record at the end. Anyone with any help? Thanks
Sxeptomaniac Posted February 24, 2005 Posted February 24, 2005 I did this once using a looped script. I always needed to duplicate a set of records created about a month ago, so I used the created date field as a marker. I would send it back to the first record and omit it at the end of each loop, then check if the current record was created on todays date. If so, it would exit the script. It served my purposes. It looked a little like this: Go to Record/Request/Page [First] Loop If [Date_Created = Get(CurrentDate)] Exit Script Else Duplicate Record/Request Go to Record/Request/Page [First] Omit Record End If End Loop It's been a while since I used this, though, so I don't remember if I got the order quite right.
BobWeaver Posted February 25, 2005 Posted February 25, 2005 How it behaves, will depend on whether the database is sorted or not. You should add an Unsort step at the beginning of the script. Then, you are guaranteed that new records will be placed at the very end of the file.
aaa Posted February 25, 2005 Posted February 25, 2005 Sort( on Any field better unique) Loop Duplcate record/Request Go to Record [Next] exit after last Endloop
MoonShadow Posted February 25, 2005 Posted February 25, 2005 Another option that works well is to start from the end and work backwards. Sort order is irrelevant and Omit is quite fast. It also allows one to work on the newly duplicated record, setting any additional fields before moving on; as well as 'returning' to the original record to capture anything from the newly created one, such as the new record's unique ID (for cross-reference) or the new Auto-Enter (which may end up different from the original record). I use this for creating new Activity records and the new assigned person may be different from the original - but the newly assigned person is inserted back into the original as "Work turned over to bla bla, Activity ID bla bla" If using Insert From Last Visited, the fields must be on the layout. It allows everything to be completed in one pass and provides great flexibility. The theory of this method is also easy to remember and work with. It would look like this (once you have your found set) ... Go To Record/Request/Page [ Last ] Loop Duplicate Record/Request/Page ... do whatever you wish to the new record ... Omit Record ... do anything you wish to the original record (plus insert stuff from the new) ... Omit Record Exit Loop If [ not Get(FoundCount) ] End Loop Show All Records Admitted, you will lose your original found set. But I've found that with this method, I can do everything needed to the set of records as I progress so there is no need to retain the found set.
bruceR Posted February 25, 2005 Posted February 25, 2005 On a Mac: perform applescript: duplicate every record
Recommended Posts
This topic is 7214 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