AnsweredAssumed Answered

How to run a script from another script?

Question asked by mbl1230 on May 12, 2018
Latest reply on May 13, 2018 by philmodjunk

I am pretty new to FileMaker so I hope my description and questions make sense. First, let me describe what I am doing and then ask a couple of questions regarding the approach.

 

I am trying to learn more about FileMaker by writing a simple database for a check register. The fields of the database consist of user entries such as date, amount, and type as well as some calculated fields such as an incremented check number when the type of entry is a check. The dependence on type of entry is implemented in a script triggered upon committing a new record and that script seems to be working properly.

 

I have a form layout to enter user specified data into the register and I would like to be able to see the register when I am adding the new entry. My limited understanding of FileMaker is that to do this requires a portal to a related table so I cloned my primary table and imported all the records from that table to the cloned one and added a cartesian product relationship between the tables. Unfortunately, adding a record to the primary table did not add to the cloned table so I wrote a script called “cloneRecord” that copies the new record from the primary table field-by-field to the cloned table.

 

With both tables identical I can then add a portal to the form layout to display the cloned table. This all seems to work with one exception. I must manually activate the “cloneRecord” script after adding a new record to the primary table. I tried adding a Perform Script command at the end of the script triggered on entering a new record to clone the record automatically, but that seems to hang up the database.

 

I have two questions regarding this. First, am I misunderstanding the Perform Script command and/or how to use it? Should running the cloneRecord script called from within another, triggered, script work as I am using it? The second, more general, question is whether there is a better way of being able to display some contents of a primary table from within a form capable of adding records to the primary table?

Outcomes