gardenlevel Posted February 29, 2008 Posted February 29, 2008 I'm trying to write a script that searches for records that match a certain criteria (that's done) Then I want to make a copy of each of those records and change one or two values. I thought I could do this with a loop, but my loop just keeps copying the first record over and over, even though my script says: Go To First Record LOOP Duplicate Record Go To Next Record Exit when hit last record from original search (done with variable) End Loop Why does this keep copying the first record instead of going to the next record and eventually stopping?
mr_vodka Posted February 29, 2008 Posted February 29, 2008 Its not copying the first record. If is making a copy of the copy. So it looks the same but it isnt. Also you dont need to do this with a variable. You can use go to record [next]. There is an option to exit the loop after the last record. To keep your orig found set, try opening a new window to duplicate the record and then close the window right after. Your orig window will keep your orig found set. Therefore, you can go to the next record to duplicate.
Lee Smith Posted February 29, 2008 Posted February 29, 2008 Try this script Go to Layout [ “Layout #1” ] Loop Duplicate Record/Request Omit Record Go to Record/Request/Page [ First ] Omit Record Exit Loop If [ Get ( FoundCount ) = 0 ] End Loop
Fitch Posted February 29, 2008 Posted February 29, 2008 John's suggestion (use a new window for the duplicating) and Lee's example (omit as you go - also possible to do in a new window if you want to keep your found set) are both good methods. I think part of your problem is that FileMaker's Duplicate command behaves differently depending on whether your found set is sorted or not. When it's sorted, the dupe will follow the original, so you can then go to the next record. But when the records aren't sorted, the dupe drops to the bottom of the list. That's where the Exit After Last option would have rescued you.
Recommended Posts
This topic is 6113 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