1 Reply Latest reply on Jun 26, 2012 12:00 PM by philmodjunk

    Get a value from last row in a portal

    SlicChic

      Title

      Get a value from last row in a portal

      Post

      I'm trying to get a value from the last row in a portal.  I have a portal set up to list the date and balance of all receipts for a client.  I want to have a field that contains the last receipt balance for a certain calculation.  I'm new to scripts and have a feeling that this will involve one.  Any help?

        • 1. Re: Get a value from last row in a portal
          philmodjunk

          If this is an unflitered, unsorted portal, you can use a calculation with Last ( Portaltable::balance ) to refer to the last related record--which will be the same as the last record in your portal.

          If you sort and/or filter the portal, you may need to use:

          Go to Object ["portalObjectNameHere"]
          Go to Portal Row [last]
          Set Field [LayoutTable::Field ; PortalTable::balance] // or use Set variable [$variable ; value: PortalTable::balance ]

          To give a portal an object name, select it while in layout mode and enter that name in the Name box on the inspector's position tab.

          Go to object ensures that this script will work even if there is more than one portal on your layout--good practice to use even if you have only one portal, as you might add one at a later date and you wouldn't want that change to break this script.