3 Replies Latest reply on Sep 5, 2012 4:24 PM by philmodjunk

    scripts

    ShelleyM

      Title

      scripts

      Post

      Hi, I'm using FM Pro v.11.  I would like to add a script to a layout that I have.  The layout has multiple records displayed with several fields in each record, it looks like a list.  When a new record is added I would like the list to sort based on the record's unique ID (it is an auto create ID) and scroll the window to the top so the new record is at the top of my window.  I have tried the sort records script, by ID in ascending order which does work however the window is always at the bottom of the screen with record 1.  I then added the scroll window script using each option (home, end, page up, etc.) and I still end up at the bottom of the screen with record 1.

      To complicate matters, the records are being created in another application via MySQL.  When I deal with the record in FileMaker, I first refresh the window to get the record to show up.  This is when I'd like the script to run so I can see my newly added record at the top of my screen.

      I appreciate any help with this!

      Thanks

        • 1. Re: scripts
          philmodjunk

          Where will the newly added record be in your found set?

          Is this auto-entered ID a number that increments with each new number?

          If it is an incrementing number, you could sort your records by this field in descending order--making the new record the first record in the found set and then Go to Record [First] should put the focus on the new record and scroll it into view.

          • 2. Re: scripts
            ShelleyM

            PhilModJunk,

            That was fast!  The ID is an incrementing number.  I just tried your suggestion and it looks like it did the trick!

            Thanks so much,

            Shelley

            • 3. Re: scripts
              philmodjunk

              Note that once you have sorted these records in this order, each new record should automatically appear at the top without any need to sort the found set again. This is usually a source of complaint and a feature that now can be turned on or off in FileMaker 12, but here it could be a quite useful feature by avoiding the delay in sorting records each time.