Jabert Posted October 28, 2017 Share Posted October 28, 2017 Can someone please explain the Set Field script step? I have attached a simple file, with a one step script. It seems to me that this script should change Field B in Layout 1 to the value of field D from Layout 2. But when I run the script nothing happens. TIA Untitled 10.19.22 AM.fmp12.zip Link to comment Share on other sites More sharing options...
Steve Martino Posted October 28, 2017 Share Posted October 28, 2017 Set Field By Name requires the field to be on the layout. If you ran your script with the debugger you would see it gives an error "Layout object missing" Link to comment Share on other sites More sharing options...
Jabert Posted October 28, 2017 Author Share Posted October 28, 2017 I am guessing that you meant that either Field D had to be on the layout containing Field B ( or vice versa). I tried this both ways; fields D and B are on both layouts. Running the debugger shows an "(102) Field is missing" error in both cases. Link to comment Share on other sites More sharing options...
doughemi Posted October 29, 2017 Share Posted October 29, 2017 Set Field by Name requires a literal text (or variable which contains literal text)(or calculation resolving to literal text) describing the target field's name. IOW, the script step should be Set Field by Name("Table1::B"; Table2:) It is typically used where you need to calculate the field name, not for setting a field whose name you know. The way your script is written, FM is looking for a field named "" (which is the content of Table1::B) to set, which, of course doesn't exist. Link to comment Share on other sites More sharing options...
AHunter3 Posted October 29, 2017 Share Posted October 29, 2017 The main problem is that you're using the wrong command entirely. Your thread title refers to the use of Set Field. You didn't PICK Set Field, you picked Set Field By Name. Set Field By Name is a wonderful power tool but it's for doing something more complicated than what you're trying to do. a) Delete the Set Field By Name and replace it with Set Field b) Now set it up just as you attempted to set up Set Field By Name: Set Field [TABLE 1::B; TABLE 2:] If you'd picked the correct command, your usage would have been correct all along. Link to comment Share on other sites More sharing options...
Recommended Posts