Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6102 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am trying to find records, duplicate them, and replace with a specific value. I want to do this in a script. I run the find say for the number 7 , I might find ten records, I want to duplicate the 10, and replace the 7 with a 9 in all 10 duplicated records. I have tried using if and loop statements and I am not getting the desired results. Is there a -foreach- someplace.

like:

find 7

foreach found duplicate replace 7 with 9

Posted (edited)

Well here is a link to a recent thread on how to duplicate records.

http://fmforums.com/forum/showtopic.php?tid/193589

To change the field with a '9', add a set field step after the duplication within the loop.

Edited by Guest
Changed wording
Posted

I am doing this

--

Go to first record

Duplicate

replace field contents

omit record

go to next record (exit after last)

...

--

It goes to the first record, does duplcate it but becomes 3rd record in this case because I only find two records. I cannot go to next record because I am at the last record after omit. I did use sort but it puts at the dupe at end.

Posted

Welcome to FM Forums, crowman.

In your script, the replace will affect the original as well as the duplicate, which is not what I think you intended. Try John's suggestion of Set Field. I.e., you'll be changing the value as you go along rather than mass-replacing.

Also read the discussion that he linked, I believe it will answer your questions about duplicating.

This topic is 6102 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.