Don't use Clear. Use Set Field. Clear needs the target field to be on the current layout to work. Set Field does not.
Set Field [ Prosjekt::z_newProject ; "" ]
Okey, the target field was a part of the current layout tough. hmm.
But I change it to set field and this worked. Thanks alot vaughan!
The Clear script step does require a target field to be set but the field NO longer has to be visible on the layout.
- If the field is on the layout - Clear will work
- if the field is on the non-visible part of the layout (whatever that area to the right is called) - Clear will work.
- if the field is NOT on the layout - Clear will work
It certainly used to be true the field had to be visible on the layout for Clear to work but at some stage FileMaker Inc resolved the limitation and the fields no longer have to be on the layout.
The Replace Field Contents script is another script that has changed behaviour. For years I kept writing scripts with a dedicated replace layout because in earlier versions of FMP the field had to be only the layout for the script step to work. From about FMP9 onwards, that limitation was removed.
The 12/13/14 help documentation does not mention this change in behaviour. Maybe it was mentioned in FMP9/10 when the behaviour changed but there is no mention that the field "is no longer required to be on layout"..
Not sure if other script steps like Cut, Copy, Paste and Insert Field Contents work when the field is NOT visible on the layout.
Hope this helps
- if the field is NOT on the layout - Clear will work"
The field MUST be on the layout.
Maybe the field was not set to allow entry our was hidden?
Sorry, my bad. Thanks for the prompt correction Bruce.
The fact that a field no longer needs to be on the layout for Replace Field Contents to work, I did build a quick test database to experiment with the Clear script step before posting my reply. Duplicating a layout, I forgot to remove the fields from the non-visible area to the right and I thought the layout had NO fields on it while testing. Doh!
The field MUST be on the layout for the Clear script step to work.