March 11, 200817 yr 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
March 11, 200817 yr 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 March 11, 200817 yr by Guest Changed wording
March 11, 200817 yr Author 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.
March 11, 200817 yr 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.
Create an account or sign in to comment