2 Replies Latest reply on Jul 14, 2011 8:15 AM by philmodjunk

    go to the last record in a portal



      go to the last record in a portal


      i'm using fmp 11.

      I have a portal with 10 rows, the related records now are 15, how can i automatically go to the last record (or create a new one) when I click on a button or in the portal?

        • 1. Re: go to the last record in a portal

          This might be helpful.


          You can use script triggers on a portal, I beleive.  Or make the portal a button if that doesn't work (or a separate button).


          • 2. Re: go to the last record in a portal

            An alternative to adding new records to the bottom row is to set up a script and button to create a new portal record that appears at the top of the portal so that you do not have to scroll the portal.

            A script like this can create a new portal record:

            Set Variable [$ID ; Value: LayoutsTable::PrimaryKey ] //use your Layout, table and field names in place of mine here
            Freeze Window
            Go To Layout [Portal table layout]
            New record/Request
            Set Field [PortalTable::ForeignKey ; $ID ]
            Go To Layout [original layout]

            That creates the new record. To get it to appear at the top of the portal, enter portal set up and specify a sort order for the portal that places such a new record at the top of the portal. There are many differen possible sort orders you could set up for that depending on the data in your portal's table and how you need to see the data in the portal displayed. The simplest, is to sort the records in descending order based on a serial number field defined in the table. This orders your records so that the most recent is first and the oldest is last--which may or may not work for you. Ascending sort orders that exploit the fact that all your fields save one in your new record are blank may also work to put your new record at the top.