March 24, 200520 yr I know how to set the value of one field to another field, the trouble I'm having is making the script run through all the records and set the value of one field to another field. Here's what I have for the script: Go to Layout ("Layout 1") Show All Records If [Field 1="A"] Set Field ["Field 2", "A"] End If What's the proper way to make it run through all the records and set the values of Field 1 to Field 2? Would a Loop Statement work? Not exactly sure how to setup the syntax. Please help!! Thanks Ron
March 24, 200520 yr Show All Go to Record(first) Loop If.... Set Field... Go To record(next, exit after last) End If End Loop ** edit: do yourself a favor and make a backup copy of the file before running scripts that change a large number of records... just in case.
March 25, 200520 yr Just off the top of my head: How about the replace spript step for field 2, using the calculation Case(field1="A"; "A"; field2). This will probably be much faster then a loop. Thus if the field2 will be populated with A if field 1 is A, but left to its original value (field2) if the condition is not met. Good luck. PS I wish the Fm designers used additional words in the terms for the script and functions "replace" and "substitute". It would create less confusion.
March 28, 200520 yr Author SBG2 - Thanks so much for the loop script, I tried it and it worked, but then I tried the Replace & CASE from Old Sneakers and that was a lot quicker. Thanks to both of you for solving it...this will make things a lot easier! P.S. I did make a backup copy to test this on. Thanks for the tip.
March 28, 200520 yr A few things to note ... In vs. 6, Replace Contents requires the field be on a layout before it will work. It also will not provide an error message if the record is currently locked by a User in networked environment, so if this is a networked solution I'd use the Set Field instead. Curious that, in vs. 7, is still indicates the field must be on the layout but tests prove otherwise. LaRetta
Create an account or sign in to comment