Get ( ActiveFieldName ) can return the name of the field where you've currently placed your cursor.
Set Field By Name can then be used to modify the field by the name returned from the above get function.
I have worked with these function this afternoon but they don't seem to work. Example: Set Field By Name [ Get ( ActiveFieldName ); "o" ]
Maybe its because I am using the field as a button.
Also I can't see what the formula is to initially test for the current field value: If [ (WORKORDERS::RecordComplete = "o") ]
Note that I said Get ( ActiveFieldName ) can return the name of the field where you've currently placed your cursor.
If you use the field as a button, you haven't put the cursor into the field. If you want to use the field as a button, use GetFieldName(YourTable::YourField) as the button's parameter.
To test the contents of the field before you modify it, use GetField( get (ScriptParameter) ) if you've passed the field name as a parameter.
Thank you Phil for the hints as to the proper structure to use to formulate a script by button and a script which can be repurposed on a use by use basis. What I found is if I name the field I wish to enter as an object and pass the object name to the “Toggle Check” script as a button using a script parameter the GoToObject script step will send the focus to the "button's" field. Then the field’s current state can be determined (either "x" meaning checked or "o" meaning empty box so the box can be toggled. I then added GotoField[ ] [ Select/perform ] so the field is cleanly exited.
I need to mention one more point when the record was created I had auto-enter data set the field to "o" empty box. That way when the form is viewed the empty box is seen which is the analogy to an empty box on a paper form.
Go to Object [ Object Name: Get ( ScriptParameter ) ]
If [ GetField ( Get ( ActiveFieldName ) ) = "o" ]
Set Field By Name [ Get ( ActiveFieldTableName) & "::" & Get ( ActiveFieldName); "x" ]
GotoField[ ][ Select/perform ]
Set Field By Name [ Get ( ActiveFieldTableName) & "::" & Get ( ActiveFieldName); "o" ]
GotoField[ ] [ Select/perform ]