Activating the right portal row after coming back to it

Discussion created by mariusjostfm on Apr 12, 2014
Latest reply on Apr 13, 2014 by Daniel Farnan

using: FM12 advanced (PC)


Portals can be a bit**h to navigate )-: This makes me nuts since days...


I have a portal, "line items", and have no other choice than leaving it to create other data in certain cases, to take away the task from users to add additional documents etc. All this works great!


Using Get(ActivePortalRowNumber) fails miserably because the user will enter a date for the line item - and this can sort the portal row anywhere in the portal. This leads to losing row focus and it means after entering "2x Northsea Fish, 12 March 2014", the row is immediately sorted into the middle of the portal just after entering the date via the date selector.





When I come back to the portal, and of course I am equipped with the original RecordID, using Get(RecordID), I use the following self-join: (both tables represent the lineitems table)


lineItems_GobalRecID lineitemsForPortal



I have read in the Filemaker online scripting reference that I can use go to related record:


If this script step is used from an active portal row, and the portal’s table is the related table, then the related record in that table is made current. If the portal’s table is not the related table, the first related record in the found set is made current.



At the moment my script looks like this:


While in the portal: setFieldValue global.RecordID =Get(RecordID)


then I leave portal to create some important data in different other tables (really no other choise)...


Go to layout LineItems

go to object [lineitemsPortal]

Go to portal Row [Select:Last] //works, but It just hightlights the last record ID, but will not go to the record I had originally worked at.

Go to Related Record [From table: "lineItems_GlobalRecID; using layout: unknown] //I had also tried "from Table "lineItems_GobalRecID" here.. did also not work.


How can I make this work? Do I have to "activate" a field or row before executing "go to related record"??


Thanks for any hints!!!