I would like to write a script which goes to the first field of my layout, then evaluate if it is empty or not; if yes, it inserts "n.s." [not specified] and if it is not empty, it goes to the next field. And so on until the last field of my layout. In the end, it makes either a beep or a window appears saying "all done" (but this last part is optional and I can already do it).
My goal is to have a button which activates this script only when I press on it.
Up until now, I could make my script go from one field to another, but it would not write anything in the empty field it met... Aditionnally, most of the written function need a named target field and I would like to be able to go automatically from one field to another without having to change the target field name myself.
Here is my script at the moment:
Go to Field [Select/perform; Layout#1::Field#1]
If [IsEmpty ( Get ( ActiveFieldName ) )]
Insert Text [Select; "n.s."]
Go to Next Field
End If
Beep
It beeps but it doesn't write anything...
Or do you see a better solution ?
Not sure why you would need this, but if necessary, you could do it this way:
Go to Next Field
Set Variable [ $start; Value:Get ( ActiveFieldName ) ]
Loop
If [ IsEmpty ( Get ( ActiveFieldContents ) ) ]
Insert Text [ “n.s.” ]
End If
Go to Next Field
Exit Loop If [ Get ( ActiveFieldName ) = $start ]
End Loop
Beep
Note that this is (purposefully) not committing the record. And of course, all fields on the layout (or at least the fields that you want to include in this process) must be included in the tab order.