4 Replies Latest reply on Jul 19, 2010 3:04 AM by LaRetta_1

    New to Filemaker



      New to Filemaker


      How do I copy the contents of a field from one table to another field in an unrelated table using a script that will loop through all the records in the first table?

        • 1. Re: New to Filemaker

          We need more information.  Usually something isn't quite right if you need to do this because it defeats the principle of normaization (where data only resides in one place and is 'related' wherever needed).

          Can you explain what you are doing?  Anyway, one simple way would be to perform a find in the first table for the records you want, then go to a layout based upon the second unrelated table and perform an import.  But I really suggest you share more details so we can possibly help you avoid a pitfall.

          • 2. Re: New to Filemaker


            I have used Superbase for more years than I care to remember and most of my work was Form (Layout) based.  Trust me, I have worked extensively with Relational Databases and understand normalization.  I produce a small telephone book that is printed both sides on two sheets of A4 card and then guillotined to A5 so that it finishes up just four pages, double sided pages.  It consists of Forename, Surname and Telephone number from a Name and Address Table.  This means it has to be printed from 'Adams' to 'Cook' and then from 'Herrington' to 'McCall' or whatever combination that is 28 lines long.  The top half of the first A4 sheet has a picture on it and the bottom half has the names and telephone numbers.  The way I do this is to have a second table with a single record with 500 fields so that I can manipulate the layout.  It is very difficult to describe in words.


            Ron Cooper

            • 3. Re: New to Filemaker

              Could you please tell me why this does not work.  I have had to type this in because I could not copy and paste.  I am using Windows 7 (64 bit)

              Set Variable [$x%%;Value:0]

              Open File ["Telephone Book"]

              Open File ["Seniors"]

              Go to Record/Request/Page [First]


                 Set Variable [$x%%; Value:+1]

                 Allow User Abort [On]

                 If [$x%% = 1]

                    Set Field By Name ["Telephone Book::F001";Seniors::Forename]

                 End If

                 Go to Record/Request/Page [Next; Exit after last]

              End Loop

              • 4. Re: New to Filemaker

                Well if it is very difficult to explain (from your side), how would you imagine we can *get* it from ours?  With what you've described, and simply attempting to answer your exact need, you can use variable to hold the value from one field, go to the oher table and set the field value with the variable - back and forth. 

                You could create an array in the variable and then parse back out in one whack but with 500 fields, it would be a nightmare to implement if something changed. 

                Still ... layouts in FM can print in various ways, including sliding up and multiple column.  It is quite possible that there are other easier methods but we could not suggest without seeing your file.  The fact that you are setting 500 fields in a second table seems unnecessary.

                Why don't you only copy the KEY from your main table over to the second table.  Then place your fields from the first table on the layout.  Since they relate, it would be 1:1 and it would be same as copying the data over.