5 Replies Latest reply on Mar 25, 2013 6:31 PM by BruceHerbach

    Matching fields on import

    kap

      I've created a FileMaker Pro 12 database with 15 tables, which will be used to create 20 runtime solutions.

       

      I've writing a FM script to merge (i.e. import) the contents of the runtime solutions into a single database.

       

      Two big problems, which seem ridiculous to me, so I must be missing something (I hope):

       

      1) There doesn't seem to be any way to pre-select the source table automatically i.e. To say "match the fields in the source and destination tables named Staff" (I can only specify the destination table), which makes it impossible to do this without bringing up the import dialog box (15 * 20 times each time a merge is done).

       

      2) Even when I do this manually with the import dialog box and have "matching names" selected, not all fields are being matched correctly.

       

      Kap

        • 1. Re: Matching fields on import
          BruceHerbach

          Kap,

           

          For question 1,  when I script imports, the destination table is based on

          the current layout table and the source file is based on a variable name.

           

          In the script when you set it up, set you options, fields and check perform

          without dialog.  As long as you don't open the script step it should stay

          as set

           

          For question 2 confirm the fields that don't match actually have the same

          name. If nesasary copy and paste the name from one file to the other to

          correct a problem

           

          HTH

          Bruce

          Sent from my mobile device... Please excuse typos.

          • 2. Re: Matching fields on import
            kap

            Hi Bruce,

             

            Sorry, I should have been clearer. I'm navigating to the relevant layout before importing and the target is correct. I have no problem specifying the source file, just the source table.

             

            When I run my script without the import dialog, it doesn't work (I'm assuming for the reason given below).

             

            When I run my script with the import dialog, the source and target tables don't match e.g. The source table is "Staff" and the target table is "People". I can correct this manually by selecting the correct source table from the list and everything works (but this is useless because it'd have to be done 300 times).

             

            Is there any way of specifying the source table in the script?

             

            Kap

            • 3. Re: Matching fields on import
              BruceHerbach

              Kap,

               

              I can't test this now,  but when I have set up import scripts in the past,

              I do the initial setup with the source file available and select the table.

              The switch it to a variable for the script.  I believe that this keeps the

              source table.

               

              My apologies if you have already tried this and had it fail. It has been a

              while since I have done it this way.

               

              Lately I try to export the data as XML and then import matching on field

              names.  For smaller data sets this works and avoids your problem.

               

              I started this when having to import records from one table to another in a

              single file.  It scripted easily and worked consistently. I put the XML

              files in the temp directory so they would be deleted when the user logged

              out.

               

              Bruce

               

              Sent from my mobile device... Please excuse typos.

              • 4. Re: Matching fields on import
                kap

                > I do the initial setup with the source file available and select the table.

                > The switch it to a variable for the script.  I believe that this keeps the

                > source table.

                 

                That did the trick - thanks Bruce :-)

                 

                Just curious - why would the XML alternative only be for "smaller data sets"?

                 

                Kap

                • 5. Re: Matching fields on import
                  BruceHerbach

                  Hi

                   

                  Glad you got it working.

                   

                  The issue with XML is that you have to export the data first, then import.

                  So if it is a large data set it can take awhile.

                   

                  Bruce

                   

                  Sent from my mobile device... Please excuse typos.