1 Reply Latest reply on Mar 16, 2011 10:00 AM by philmodjunk

    Going to a portal row



      Going to a portal row


      I have a set of records that are characterized by "type".  I have a layout (called PortalLayout) that has a portal that shows all "types" and then below that a separate portal that shows all records within that "type".  However, due to size limits, I can only show 15 portal rows at a time for the "type" portal and so I have a vertical scroll bar to see the other portal rows.  I also have a more detailed layout (called DetailRecord) for each record.  On the DetailRecord layout, I have a button that will take me to the PortalLayout using the current record's "Type".  On the PortalLayout portal that show all "types" I can successfully highlight the current type selected when I push the button and it will show me all records within that "type" in the portal below it.  However, the selected "type" portal row may be past the top 15 rows in the portal and so it doesn't initially show on the screen and I have to scroll down to find it.  How can I get the portal row to show up properly on the screen when it is below the top 15 rows visible in the portal? 

        • 1. Re: Going to a portal row

          You can use Go To Portal Row to scroll the portal to a desired row.

          Since you have more than one portal on your layout, give each portal an object name. That way you can use go to object to set the focus on the desired portal so that Go To Portal Row acts on the correct portal.

          If you know or can compute the row, you can just use a single Go To Portal Row step. If you do not, you can loop through the portal rows until you reach the desired row:

          Set Variable [$SelectedType ; Value: PortalTable::Type ]
          Go To layout [//portals layout]
          Go to Object ["PortalObjectNameHere"]
          Go To Portal Row [select ; first]
             Exit Loop If [ Get ( CurrentPortalRowNumber ) = Count ( PortalTable::ForeignKeyField ) ] // you can count any field that is never empty
             Exit Loop If [PortalTable::Type = $selectedType ]
             Go To Portal Row [select ; next]
          End Loop