AnsweredAssumed Answered

Script Trigger to create multiple records from one record in different tables

Question asked by PhotoBuffoon on Apr 16, 2012
Latest reply on Apr 23, 2012 by philmodjunk

Title

Script Trigger to create multiple records from one record in different tables

Post

Hi I'm trying to automate the creation of some records in a table from the fields of one record in another table.  

Using FileMakerPro 11 Advanced on a Mac

Scenario:

In Table "Orders" I have imported many files into a container field (1 for each record).  Each record will then have a barcode scanned into a Customer ID# field so each file will match back to a related table with the customers ID#.  I then populate an order field.  The order field then populates various calculated fields based on the order type.  Each record/order can represent multiple pieces of work for completion that I need to have as individual line items that match the order# in another table.

e.g.

Table "Orders" Record 1

Container Field: xyz

File Path: user/xyz/filename

ID#:1001

Opt1 (OrderType):1

Opt1_1:[If(IsEmpty(Option1)=0;FilePath;"False")]

Opt1_2:[If(IsEmpty(Option1)=0;Filepath;"False")]

Opt1_3:[If(IsEmpty(Option1)=0;Filepath;"False")]

        There are many other options with calculated fields as well.

Table 2 - Requires each True calculated field above to be a separate record in another table but with the same ID#

e.g.

Record 1

ID#1001

Opt1_1User/folder1/filename

Record 2

ID#:1001

Opt2_2: User/folder1/filename

   Record 3

ID#:1001

Opt2_3:User/folder1/filename

 

And so on and so forth.  The actual number of potential fields is quite large (40+).

 

I would like to trigger the creation of the records in Table 2 when I hit a submit button in a layout based on the "Orders" Table.

 

Any ideas would be helpful.  I'm new to scripts and have not found anything on the forum that seems to be similar to what I'm trying to do.

 

Look forward to your comments.

 

 

Outcomes