Greg
Greg

Reputation: 47124

FileMaker - How to create a new record in another table for each record in a found set

I want a user to be able to do a search in the layout/table "Cages" and then click a button to run a script that will create a new record in a table called "CagesProtocolLineHistory" for each record in the found set.

Below is what I have so far which almost works but on go to original layout line it doesn't go to the next record, it goes to a record near the end. I.e., it's skipping some records.

enter image description here

Upvotes: 0

Views: 12654

Answers (2)

Dycey
Dycey

Reputation: 4685

You could do this in a three step: search for the "yes"s in a new window; export the record ids (passed params) to a local temp file, and reimport the ids into the child table.

Upvotes: 1

Mikhail Edoshin
Mikhail Edoshin

Reputation: 2669

Yes, Go to Record[ first ] before the loop will ensure that all records are copied. Otherwise, if the script starts at some record other than first, it will skip all records before this.

A couple of notes: FileMaker string comparison is case-insensitive by default, so you don't need to use Upper() here. Also, in most cases it's simpler not to copy all data through variables, but pass a single key and copy other data via lookups.

Upvotes: 3

Related Questions