2 Replies Latest reply on May 17, 2010 2:53 PM by aammondd

    How to copy fields between two different databases



      How to copy fields between two different databases


      I have two seperated databases.
      How do i copy all info from all the fields in database01 to fields in database02?

      This is what i have tryed:

      Database01, containing fields:


      With a button containing the script:
      Open File ["database02"]
      Perform Script ["pasteintodb02" from file: "database02"]

      and Database02 containing fields:


      Database02 has the script "pasteintodb02" attached to it:
      New Record/Request
      Paste [Select; database02::b1


      What it does is, that it copy from database01, field a1 and paste it into a new record in database02 in field b1.

      What i want is to copy a1,a2,a3 from database01 into (a new record in) b1,b2,b3 of database02.

      The problem is that when i use the copy/paste method it will only copy one field not all of them.



      I´m not that good at FM so if you can help, then please be verry graphic about how to do it ;-)

        • 1. Re: How to copy fields between two different databases

          Check out import records, You can use that to import all the data, or just the data in the current found set from one filemaker table (or selected other files) into a different table in filemaker. There are lots of options, so read up on the tool in Filemaker Help and make a back up copy of your file before importing so you can toss the file and try again if you don't get the results you expect.


          On a side note, Copy and Paste are usually best left unused when moving data around. Copy destroys any data your user might have previously copied to the clip board and both steps only work if the referenced field is on the current layout. Future edits of a layout can thus break these scripts and you won't know they're broken until you notice that data is not being copied and/or pasted.


          For moving smaller amounts of data use either Set FIeld or set field in combination with set variable instead of copy/paste.

          • 2. Re: How to copy fields between two different databases

            You can use the import function instead

            You may need to use the match field and update and add new records that are the same if you plan to continue to use both databases.


            Or you can create a temporary table in each database add a button to create a record in the temp table for each record you wish to transfer. (you only want to do this once so you need to create a relationship between the tables to check that it isnt already there) 


            When you want to transfer you import from this temp table into the receiving database.