[FileMaker] 次のレコードへ移動する際、現在と同じフィールドへ移動する

FileMaker のスクリプトで次のレコードへ移動するとする。その際、前のレコードと同じフィールドにフォーカスを持っていきたい。この方法に少し悩んだのでメモしておく。

面倒なやり方としては、Form View にした上で対象のフィールドにオブジェクト名を付ける。次のフィールドへ移動して、Go to Object でオブジェクト名を指定して移動する。

でも実は、特にフィールドにオブジェクト名を付けなくても、変数を使えば楽だ。すなわち以下のようなスクリプトにする。

Set Variable [ $field ; Value: Get ( ActiveLayoutObjectName ) ]
Go to Record/Request/Page [ Next ; Exit after last: On ]
Go to Object [ Object Name: $field ]

参考:
Go To Field ScriptStep by Calculation or Variable? – Script Workspace and Script Triggers – FMForums.com
https://fmforums.com/topic/57594-go-to-field-scriptstep-by-calculation-or-variable/

Set focus on a specific field by calculation — FileMaker Community
https://community.filemaker.com/en/s/question/0D50H00006yS8ri/set-focus-on-a-specific-field-by-calculation