2 Replies Latest reply on Jul 13, 2016 10:45 AM by wimdecorte

    Importing (via FM scripting) Issues

    vanessa.vinson

      I am new to FileMaker, and I am needing help writing an import for a file.

       

      I have been successful in reading in the file; however, it is picking up the headers.  I am unable to check the header box as it is grayed out. 

      How do I get to ignore headers in the script?

       

      I am also wanting that when it updates or adds a new record to only show that found set that was modified or added.

      How do I get the found set to display after the import is complete (with only the modified/added records).

       

      After the import completes I get a pop-up message that says:

      "There are less records in the data source than in the target table. Not all records were updated. "

      Is this bad? If so how do I fix it?

       

      In my code I say (can't share real layout/table names):

      Go to Layout ["ABC" (the Table)]

      Import Records ["$path"; Update existing; Mac Roman]

       

      Any help on these 3 subjects is greatly appreciated.

       

      Thank you,

      Vanessa

       

       

        • 1. Re: Importing (via FM scripting) Issues
          Mike_Mitchell

          Hello, Vanessa. Welcome to FileMaker!

           

          Your questions aren't exactly clear; probably due to being new to FileMaker and unfamiliar with the terminology. So I'm going to take a stab at answering based on what I think you're asking, and you tell me if it's wrong.   

           

          vanessa.vinson wrote:

           

          I have been successful in reading in the file; however, it is picking up the headers. I am unable to check the header box as it is grayed out.

          How do I get to ignore headers in the script?

           

           

          I don't know what you mean by "headers". What format are you importing from?

           

          I am also wanting that when it updates or adds a new record to only show that found set that was modified or added.

          How do I get the found set to display after the import is complete (with only the modified/added records).

           

           

          I think you mean "show the records that were imported"? If that's what you want, it's part and parcel of the Import process. After an import, the found set is automatically the records that were imported.

           

           

          After the import completes I get a pop-up message that says:

          "There are less records in the data source than in the target table. Not all records were updated. "

          Is this bad? If so how do I fix it?

           

           

          When you import to "update existing", FileMaker doesn't try to reconcile existing records with the incoming set. All it does is overwrite the data, starting at the first record and going until it runs out of records on either side. So if there are more records in the source than target, it means some of the records didn't get imported - because there were not enough "homes" for all the records.

           

          I think what you really want here is "update matching" rather than "update existing". The terminology is a little confusing, but "update matching" will allow you to specify one or more key fields in the existing data that should match the data in the incoming set. Then, records that match are updated according to the field mapping you specify.

           

          Another thing to watch out for when importing is the found set. If you do indeed want to import matching records, you'll need to make sure the found set in the target table corresponds to the records you want to update. (Often, this is all records, but sometimes not.)

           

          Let us know a little more about your situation and maybe we can offer some more precise instructions.

           

          Mike

          • 2. Re: Importing (via FM scripting) Issues
            wimdecorte

            If it really is your intent to update existing records then you have to make sure that you built the proper found set after the "Go To Layout".  Otherwise you will work with whatever found set is there which may or may not be what you want.

             

            vanessa.vinson wrote:

             

            After the import completes I get a pop-up message that says:

            "There are less records in the data source than in the target table. Not all records were updated. "

            Is this bad? If so how do I fix it?

             

            Only you can tell whether it is bad or not.  What is your expectation?  That there are exactly the same # of records in the source as in the target?  Fewer?  More?