4 Replies Latest reply on Sep 24, 2010 9:21 AM by JamesSmith

    Sorting in Script



      Sorting in Script


      I have a script where I open a window, then goto a layout 1, perform a sort, then go to layout 2, perform a sort, then close the window. Then later got the layout 1 the records are not in the sequence sorted.

      Why are the records not in the sorted sequence?

      Jim Smith

        • 1. Re: Sorting in Script

          "Then close the window"

          Are you sorting on layout 1 and layout 2 in the same window and then closing it?

          Are you connecting to a database hosted over the network by either FileMaker Pro or FileMaker Server?

          Do layout  1 and layout 2 refer to different table occurrences? (Table occurrences are the "boxes" shown in Manage | Database | Relationships.)

          • 2. Re: Sorting in Script

            I am local. Using FM Pro Adv 11.

            Layout 1 uses table 1.

            Layout 2 uses table 2.

            Jim Smith

            • 3. Re: Sorting in Script

              That rules out a few of the most likely explanations.

              What exactly did you mean by the phrase "close the window"? This could be a key factor here as each window to a file that is opened has it own group of found sets, current records and sort orders. If you open a new window, sort your records and then close it. The sort order of the layout in the original window will not be changed.

              Other possible factors:

              1. Any script that sorts or performs a find on a layout that refers to the same table occurrence as layout 1 will also modify the found set, current record and sort order shown on layout 1.
              2. Any script triggers that perform a script that modifies the sort order for this layout's table occurrence, might be triggered at times you didn't expect.
              3. Go To Related Records can modify the sort order if the relationship specifies a sort order and the GTRR step specifies layout 1 or another layout that refers to the same table occurrence.
              • 4. Re: Sorting in Script

                That the answere. Colsing the window would have done it. Your reply help's me understand FM better.


                Jim Smith