AnsweredAssumed Answered

SetField Script step question

Question asked by ChrisC_3 on Feb 24, 2015
Latest reply on Feb 25, 2015 by ChrisC_3

Title

SetField Script step question

Post

I wrote a fairly basic script to move data from one field to another.

Go to layout
Show all records
Find Recordset I want to modify
Go to first record
Loop
Set Field A to Field B
Set Field B to ""
Next Record (Exit after last)
End Loop

The problem is that after running the script both Field A and Field B ware wiped with the data was nowhere to be found.

Now, I know I can use a variable to store the field value before running the SetField script step, and fortunately I do have a backup of my data so it can be restored.

The question is "why" the script failed. It produced no errors and I double checked to make sure I didn't make any silly mistakes like wiping field B before setting field A. My best guess would be that setting Field A to Field B in this manner might set a pointer to the data rather than copying over the value or that filemaker ran the SetField steps in a different order than I specified in the script, but both these options seem rather unlikely.

Outcomes