AlastairMcInnes

GoTo Related Record in a script not working ?

Discussion created by AlastairMcInnes on Mar 9, 2016
Latest reply on Mar 9, 2016 by AlastairMcInnes

I have two databases holding book data – one for print books, and the other for ebooks. They are currently related to each other via the print book ISBN which is also stored in the ebook database. The print database has an external table occurrence in it ,based on the ebook data table in the ebook database and I display the ISBN of the related ebook on a layout in the print database. I added a button setup to the ISBN field so that when you click on it, it opens the ebook database showing the correct record. It does this with a Go To Related Record call:

 

Go to Related Record [ From table: “COB_Hardback”; External; Using layout: <Current Layout> ]

 

This works perfectly.

 

To make life easier, I added a button to the print database to create a new ebook record and populate it with the data that they share (title, authors, description and so on). To make this work, I created a layout in the print database based on the ebook table instance in the print database (the COB_Hardback referred to in the GTRR call above). Then I have these lines in a script:

 

Go to Layout [ “COB_Hardback” (COB_Hardback) ]
New Record/Request

 

I have previously grabbed the common data into variables and I now copy the variables into the fields of the new (ebook) record.

This all works perfectly. The record is created and populated in the ebook database.

 

The script ends with a call to:

 

Go to Layout [ original layout ]
Refresh Window
Go to Related Record [ From table: “COB_Hardback”; External; Using layout: <Current Layout> ]

 

The intention is that the print database is returned to the layout it started on, but then the ebook database is opened and the new record displayed. The last line appears to be exactly the same as the button setup on the ebook ISBN field. The difference is that the button works and the script doesn’t.

 

If I then click on the ISBN field, to call its button setup, the ebook database opens (or activates if already open) and shows the record.

 

To test this further, I wrote a script with only the GTRR line in it and replaced the button setup of the ISBN field with a call to Perform Script with the name of my new script. It appears that the GTRR step only works if called directly from a button, and not as part of a script.

 

Or have I missed something?

 

This is in Filemaker 11 if it makes a difference, though I have tried it in FM12 with the same results.

 

Many thanks in advance,

Alastair

Outcomes