Use this as your script parameter: GetFieldName ( YourTable::TimeStartDay1am )
Then use: Set field By Name [ Get ( Scriptparameter ) ; get ( CurrentTimeStamp ) ]
To log the current time stamp into the specified field.
With this approach you format each field with button setup, but change the field specified inside GetFieldName to match the field you are setting up as a button.
With getFieldName used like this, you can change the name of your table or field and the script will get the updated name and thus still work.
Thanks Phil, I'll try it out.
The script you suggested works great - but, I need to add one more part.
How do I get the field to be uneditable once it is filled - I've tried adding to the first line of the script by using
If (mytable:todaysdate) = Get (CurrentDate) and IsEmpty (Get (ScriptParameter)) - then, I set my field, but it doesn't work.
Try using IsEmpty ( GetField ( Get ( ScriptParameter ) ) to test the contents of the field the user clicked.
If you find you are referencing the script parameter more than once in the same script, you may find it convenient to put
Set Variable [ $FieldName ; value: Get ( ScriptParameter ) ]
At the beginning of your script and then you can use $FieldName in place of Get ( ScriptParameter ).
Thank you for help this morning. I must have something out of order, or correctly worded. The script still isn't working.
I've included a picture of the steps. Again, your help is appreciated.
The syntax looks correct which means you should look at the values stored in each field and variable at the time the script executes. If you have Filemaker Advanced, you can enable the data viewer and debugger, then run the script and watch the values change. You can also watch to see if any steps return error codes while you do this.
If you do not have Advanced, you can do much of this same checking by temporarily including a show custom dialog step to display the values of $Fieldname, getField ( $FieldName) and Time cards::Date_Today.
Also, make sure that Date_Today is a field of type date, not text or timestamp.