AnsweredAssumed Answered

script to copy contents of source_field to target_field

Question asked by s on Apr 29, 2013
Latest reply on Apr 29, 2013 by debi

FileMaker Pro 12 on Server 12 - OS X


I have a client who wants a button he can place on any layout between two fields (which could be in the same table or different tables or even a different file), then specify the source and target fieldnames as the script parameter, which will then copy the contents of source_field to target_field.


The client is trainable to understand the parameter must look like this:

"source table::source_field"

& "¶" &

"target table::target_field"


or even this:

"source table::source_field¶t1_t2_x::t2_field¶"


I can then set variables for each field and the data they contain using variables:

Set Variable[$sourcefield ; getvalue(get(scriptparameter); 1)]

Set Variable[$sourcedata ; evaluate($sourcefield)]

Set Variable[$targetfield ; getvalue(get(scriptparameter); 2)]

Set Variable[$targetdata ; evaluate($targetfield)]


Then I can use Set Field By Name [$targetfield ; $sourcedata] to copy the data.


That works fine, but my question is this:

How do I make sure that the fieldnames he types into the script parameter are real fields and do not contain typos? In other words, confirm that $sourcefield and $targetfield are real.






Steve Moore

Cumberland, Maine