7 Replies Latest reply on Apr 28, 2010 7:19 AM by PaulaS

    How do I copy a record from one table to another table

    omarjt_1

      Title

      How do I copy a record from one table to another table

      Post

      I know this should be very simple, but bear with me please. How should I setup a script that copies several (not all) fields from one record in table, to a new record in another table. Thanks,

        • 1. Re: How do I copy a record from one table to another table
          Orlando
            

          Hi omarjt

           

          I do this a number of times in my solutions I run a script that finds the records I want to export, exports the data in a .diff format, any format will do except diff keeps the field names for the mapping on the import, and then imports it into the second table. It usually look something like this:

           

          #

          Set Variable [$FilePath; Value; Location of temporary file ]

          #

          ## Export Records

          Go to Layout [ First Table ] 

          Export Records [No dialog; "$FilePath" ]

          #

          ## Import Records

          Go to Layout [ Second Table ]

          Import Record [No dialog; "$FilePath" ; Add ] 

          #

          #

           

          And when setting up the script you specify the Field Mapping to either "Matching Names" if they do match, or "Custom Import Order" if they do not.

           

          I hope this helps. 

          • 2. Re: How do I copy a record from one table to another table
            NancyAdelman
              

            You don't need to export the data before copying it to another table. After you have your found set of records, go to any layout that is based on the target table.

             

            Use the Import Records command to import the records from the source table to this target table. Map only the fields you want to import. You can set the script to leave you at the target table, or return to the original layout.

            nseala

             

            • 3. Re: How do I copy a record from one table to another table
              omarjt_1
                 Thanks guys, both solutions worked.
              • 4. Re: How do I copy a record from one table to another table
                bablahemen

                And can you exlain how can we do that???

                • 5. Re: How do I copy a record from one table to another table
                  PaulaS

                  I'm having this same problem. But when I go to Import Records, I'm unable to import just my found set. I end up importing all the records from the source table (51 records), regardless of the found set I have open (10 records). What I have noticed is that:

                   

                  (1) I can only choose the current table as the target if my found set is the predominant window - but that's not the table I want as my target, or

                  (2) I can choose the correct target table if it's in my predominant window, but then it imports all records instead of the found set, even if the other window is my found set (which I'm sure doesn't matter anyway).

                   

                  ?? I have another file that was developed by someone else that works. I thought everything was set up the same but I don't know where I'm going wrong. Any ideas?

                  • 6. Re: How do I copy a record from one table to another table
                    philmodjunk

                    Note: Unless you can use the matching names option. Importing records is dangerous. You have to be very consistant in updating your field mapping each time add remove field definitions in one of the tables. This is a long standing issue with Filemaker.

                     

                    If you import from a file that is open, you get the file's current found set. Be aware that one data source table can have any number of table occurrences. Each table occurrence can have a completely different found set --so selecting a different table occurrence as your source table will import a diffferent group of records.

                     

                    If you import from a file that is not open, you get all the records in the table.

                    • 7. Re: How do I copy a record from one table to another table
                      PaulaS

                      I had to replace my Import script step and start again with the correct table occurrence. My old script step was messed up and I couldn't even choose a source table. But it works now that I refreshed it like that. Thanks!!