From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer
I have covered script variables, data concatenation and data parsing. In this example, we are going to combine these features to duplicate a found set of records and go to the duplicated records after the script is run.
In this example, I have three fields for data. One is a person name field, one is a type field and one is a the date the person was called. What I want to do is do a find, duplicate the found set of records and call them again. I did set the date field to auto entry nothing. This is done so that when I duplicate the record, the date field is empty.
FYI... normally I would have a contacts table and a calls table. I have just the one table now for demonstration purposes.
So in my example file, I have four fictional characters I want to call. All three are the alter egos of super hero characters and I want to call them for some purpose. I will leave it up to your imagination if it is an evil or good purpose (grin). So I will do a find for the type of fictional.
Now my script is going to run and here are the comments I’ve made within the script. See if you can follow along with the logic.
CLEAR MY DUPLICATE TRACKER BEFORE RUNNING SCRIPT
FIRST LOOP - copy records ids into array
SECOND LOOP - duplicate records individually
FIND THE FIRST RECORD IN THE ARRAY
DUPLICATE THIS RECORD, CAPTURE ITS ID
SLICE OFF THE TOP VALUE IN ARRAY
GTRR Newly Duplicates Via Global Data
In summary, I’m capturing all the records in the found set into a script variable. I’m then finding each record one at a time, duplicating, removing that original record from the list of records I said I was going to duplicate, adding the duplicated record to another list and then repeating the process until I have duplicated all the records in that set. Since I have captured the record ids of all the records I duplicated, I create a found set of those by using a GTRR.
An example file can be downloaded by clicking (here).
I just added a 30 minute video for this content. Due to the size and length of the video, I can only offer the movie via Dropbox. If you are interested in the movie, please send me an email and I will give you access to that folder.
This is one of my longest straight uncut videos of all time and I only struggled in a few places and had just a couple bloopers that I couldn’t edit out. In fact, I even highlighted one of the bloopers when iCal popped up a reminder for me to update my resume. I used ScreenFlow for the creation and editing of the video but I need to investigate other options. ScreenFlow 1.1 crashed on me every time I did an incremental save and Spaces wasn’t working very well with it either. Anyway, I hope to experiment with other video training products out there.
More info about the author and FileMaker in general, contact me at firstname.lastname@example.org.
© 2008 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.