2 Replies Latest reply on Sep 11, 2014 8:15 AM by Dillik

    Relookup sometimes fails to modify current record

    Dillik

      Summary

      Relookup sometimes fails to modify current record

      Product

      FileMaker Pro

      Version

      13.0v3

      Operating system version

      OS X 10.7.5

      Description of the issue

      The Relookup script step can fail to update the current record in a particular scenario.

      Steps to reproduce the problem

      1) Define a lookup field (LF) which uses a relationship based on some local key field (KF).
      2) Create several records which have values in LF which differ from the value they will look up when a Relookup is performed.
      3) Place a button on the layout which performs a relookup using KF. (The intent is to force LF to update across the found set when the KF-based relookup is performed.)
      4) In one of the records, begin editing any field other than KF (it may be LF, but it doesn't have to be). Leave the cursor here.
      5) Press the button to perform the relookup.

      Expected result

      LF should have been updated across all records in the found set (including the current record, despite the field's unsaved state in the current record).

      Actual result

      The value of LF in the current record remains unchanged (without an error code being generated), while LF has been updated in all other found records.

      If the field being edited was KF (this is what Relookup was probably written to expect, setting aside the Relookup step being able to specify a different field), the problem doesn't occur: an unsaved KF value doesn't interfere with the current record being modified (and the unsaved value is also used in the relookup, which is nice).

      We can even avoid the problem by entering and modifying KF after modifying LF: simply exiting LF to render it "saved" (record's open state aside) means there is no field (other than KF, which doesn't count) in an unsaved state, and the relookup proceeds as expected.

      Workaround

      Before performing the Relookup step (if anyone even still uses relookups), it would be helpful for a script to first go to KF to make sure there is no unsaved field (other than KF) when the relookup runs. Or you could just commit first, if you prefer the blunt approach.

        • 1. Re: Relookup sometimes fails to modify current record
          TSGal

          Dillik:

          Thank you for your post.

          The Help for Relookup Field Contents states in the Notes, "When you use the Relookup Field Contents script step, the data must be committed first before the operation is performed, or you may get unexpected results."  Therefore, be sure to commit the record first prior to clicking the button, or have the button execute a script that commits the record and then performs the Relookup Field Contents script step.

          TSGal
          FileMaker, Inc.

          • 2. Re: Relookup sometimes fails to modify current record
            Dillik

            Just looked over the help page for Relookup Field Contents. Following the clause you cited is an explanation which does not capture the essence of this problem but is instead just a copy/paste of the Replace Field Contents help page, regarding stale data being used in a replace (which does not apply to Relookup). I've used the Documentation Issues form to submit this.