AnsweredAssumed Answered

One more Go To Related Record Inconsistency

Question asked by philmodjunk on Aug 5, 2009
Latest reply on Aug 8, 2009 by RickWhitelaw


One more Go To Related Record Inconsistency

Description of the issue

Depending on your point of view, this is either a bug or undocumented behavior: Two tables: Invoices and LineItems with LineItems related via a serial ID number in Invoices, allow creation of LineItems via the relation is enabled and LineItem records are displayed in a portal on an Invoices layout. Create the following script:If [ Count ( LineItems::InvoiceID ) > 0 ]  Go to Related Record [ From table: “LineItems”; Using layout: “LineItems” (LineItems) ] [ Show only related records ]  Show Custom Dialog [ Title: "Exit Line Items"; Buttons: “OK” ]End If Set an "on Exit" script trigger on the LineItems portal.Enter data in the portal to create at least one related LineItem Record.If you exit the portal row, the script correctly takes you to the LineItems layout shows the related record and pops up the Custom Dialog. Now click in the bottom blank row where you would add a new row of data. Without entering any data, click on the layout background to trigger the On Exit script. This time, GTRR does nothing, and the Custom Dialog pops up to confirm that the script did execute. Note that there WAS a related record in the portal when I triggered the script just not on the active portal row. If you read the documentation on GTRR carefully, you'll find that "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." Apparently, the combination of an active portal row but with no related record in the active portal row keeps GTRR from functioning in a manner similar to GTRR failing when there are no related records. As a work around to avoid this issue, Use IsEmpty (LineItems::InvoiceID) as a test to keep the script from executing. Please note that both GTRR silent failures are undocumented in the help file and can be extremely hazardous to your data as they could leave an entirely different table as the current table while looping through records and changing them, performing a replace field contents, deleting records... System Info: Windows xp, FMP 10 adv v3