Is that exactly how the script is written? Try:Go To Layout [ "CUSTOMERS" (CUSTOMERS) ]Go To Record/Request/Page [First]LoopIf [ IsEmpty (CUSTOMERS::CONTRACTDATE) ]Set Field [ CUSTOMERS::CONTRACT ; " E "]ElseSet Field [ CUSTOMERS::CONTRACT ; " X " ]End IfGo To Record/Request/Page [Next: Exit after last ]End Loop
I can't edit with iPad. No " "
OK - rookie mistake but understandable
Set Field takes two arguments, the field that you're setting, and the value you are setting it to.
When you invoke Set Field, you'll notice two buttons in the bottom right corner, one for the field, (Specify Target Field), one for the value (Calculated Result - Specify)
Your target field is CUSTOMERS::CONTRACT - good, but your value needs to specified as a calculated result, in other words, when you click on Specify against Calculated Result, you're presented with a dialogue box to enter a calculation - in your case it will be "E" for your first Set Field.
Script step will then be
Set Field [CUSTOMERS::CONTRACT ; "E"]
and yes, if you use the script step 'Show Custom Dialog' near the bottom of the list under Miscellaneous, you can check what your values are doing, but better still, consider upgrading to Filemaker Pro Advanced, which includes a Script Debugger and Data Viewer..
Consider to make CUSTOMERS::CONTRACT a calculation field with the formula:
Case ( IsEmpty ( CUSTOMERS::CONTRACTDATE ) ; "E" ; "X" )
No script to run, never to worry about it ever...
Many thanks for the replies. It's interesting to me (not in a good way) that my using the script manager to build the script produced the incorrect syntax
Set Field [ CUSTOMERS::CONTRACT["E"] ] when it should have been
Set Field [ CUSTOMERS::CONTRACT ; " E " ] as you guys have pointed out.
Turns out that when the Set Field dialog box opened, I entered my text value "E" in the Repetition field at the bottom. It seemed to take it just fine, but apparently produced a Set Field command that was to repeat "E" times.... hence the failure.
I really like this approach though " Case ( IsEmpty ( CUSTOMERS::CONTRACTDATE ) ; "E" ; "X" ) " - takes me back to my C programming days in college.... so many dead brain cells from here.....
Thanks again for the help!