michele,
It's certainly possible, and not too tough.
Heres one way to do it:
I set up a test file with 5 data fields
field1 (text)
field2 (text)
field3 (text)
field4 (text)
field5 (global text)
and 3 script function fields
loop stop (global text)
field count (global number)
loop count (global number)
The following script will enter "Strawberry" into whichever of field1 - field4 that you specify in field5. The script exits if field5 is left blank or the contents of field5 does not match any of the field names on the layout (based on the tab order you have set for the layout).
----------------
#Do Nothing if field5 is empty
If["IsEmpty(field5)"]
Exit Script
End If
#Count the fields on the current layout
Exit Record/Request
Go to Next Field
Set Field["Loop Stop", "Status(CurrentFieldName)"]
Set Field["field count", "0"]
Loop
Go to Next field
Set Field["field count", "field count + 1"]
Exit Loop If["Status(CurrentFieldName) = loop stop"]
End Loop
#Find the field specified in the global field
Set Field["loop count", "0"]
Exit Record/Request
Loop
Go to Next field
Set Field["loop count", "loop count + 1"]
Exit Loop If["Status(CurrentFieldName) = filed5 or field count = loop count"]
End Loop
#If the selected field's name matches the data in the global, set that field with whatever data you need.
If["Status(CurrentFieldName) = field5"]
Set Field[""Strawberry""]
End If
Exit Record/Request
-----------------------
You could set this up as a "Go to Field" script and just call it from any other scripts that need this type of function.