1 Reply Latest reply on Feb 25, 2010 10:27 AM by philmodjunk

    Sort is almost there...

    b4farmer

      Title

      Sort is almost there...

      Post

      I'm using FMP10 Advanced. I've created a button that allows me to jump to a custom page in table view and it sorts my 1107 records by date in the jump. Is there a way in the script that I can also have it jump to the current date which is the equivalent of scrolling through half the records, while still keeping the main date sort in order? I would love this to happen without being prompted. What I have now keeps asking for a record number and I can't seem to bypass that.

       

      Any advice?

       

      Thank you in advance. 

        • 1. Re: Sort is almost there...
          philmodjunk
            

          If you want to simply scroll to the middle of your found set, use

           

          Go To Record/Request/Page [no dialog ; get ( FoundCount ) / 2 ]

           

          If you want to go to exactly the first record with today's date, you'll need to either loop through the records starting with the first record and stopping on the first record with today's date or ( If your records in your found set include all records with today's date, you could define a relationship so that you can use Go To Related Record to jump to the first record with today's date.

           

          To do this, define a global date field: gToday or an unstored calculation field with Get ( CurrentDate ) in the same table that stores your sorted records

           

          Your relationship:

           

          DateTable::gToday = DateTable 2:: DateField (DateTable 2 is a second table occurrence of DateTable)

           

          Use

          Set Field [gToday ; get ( Currentdate ) ]

          Go To Related Record [from table: "DateTable 2" ; Using layout: <Current layout>]

           

          If using a global date field. If you use the calculation field, omit the first step of the script.

           

          The <current layout> version of GTRR is a "safe" version of GTRR. If you are contemplating other uses of GTRR....

           

          Go To Related Records is a very useful tool, but which is very poorly documented. To learn more about GTRR, click the following link:

          The Complete Go To Related Record