1 Reply Latest reply on Sep 8, 2011 3:14 PM by philmodjunk

    Selecting and bringing a portal row to focus

    miw

      Title

      Selecting and bringing a portal row to focus

      Post

      I have a table called "Name".  In my relationships I have copied the "Name" table for the following realtionship:  Name>---X---<Name2.  The first tab of the layout is simple - it is used to input new records in Name.  On the second tab of the layout, I have created a portal to show all records.  The portal uses Name2.  When I move from tab1 to the portal on tab2 of the layout, my active record is highlighted in the portal via a conditional format.  All that works just fine.  However, since the records are numerous, often my active record is hidden in the portal and I must scroll to find it.  Is there a script I can write to scroll the active record in the portal to the top?  I have tried a temporary variable to try to get the active portal row number (which per the data viewer is always zero when I go through the script in the debugger) with a goto Portal Row on that variable to no avail.  I do not want to limit the portal in tab 2 to found set (that I was successful at in tab3) - I want a full listing of records in the tab2 portal.  I am stumped.  Any help appreciated.

        • 1. Re: Selecting and bringing a portal row to focus
          philmodjunk

          Get ( Activeportalrownumber ) will return the active row number of the active portal so this will return zero if you do not currently have the focus in any portal row.

          You can use a looping script with go to portal row, to scroll the portal until the specified row is visible. I don't know what other fields you have in Name, so will assume you also have NameID--an auto-entered serial number field to uniquely identify each record.

          First, use the name box at the top of the inspector's position tab to give the portal on tab2, an object name such as "AllNamesPortal".

          Then this script will scroll the row into view:

          Go to object ["AllNamesPortal"]
          Go to Portal Row [First]
          Loop
             Exit Loop If [Name2::NameID = Name::NameID]
             Go To Portal Row [next ; exit after last]
          End Loop

          The exit after last option should not be needed here, but it protects your from an infinite loop if the Exit loop If step fails for some reason.

          If you have 15 row portal, this scrolls the specified row for portals listed in rows 15 or more into the bottom of the portal. To scroll it to the top, you'd then use go To Portal row in a second loop to scroll it another 14 times or so (and in this case, you need the exit after last option in that loop as there may not be that many more records in your portal).