1 Reply Latest reply on Apr 6, 2012 11:17 AM by philmodjunk

    Import Child records into already existing Parent Record

    AnswerFeedback_1

      Title

      Import Child records into already existing Parent Record

      Post

       I have a file containing records generated by another software application. (It is a professional application that I cannot adjust the export nor will the company change it, so I am stuck with their format)

      The file justs lists records and has no information in it that would indicate a ParentID or grouping. The fact that the records are in the same file is the only indicator that they belong together.

      I would like to be able to have the user of this software create this file and then browse to a FileMaker Parent record. They would then click on a import button that would import the records of the file. HOWEVER, the file would be children of this FileMaker Parent record. So after the import, the records in the file are imported into the Child Table and correctly associated with the Parent record the user was browsing at the time.

      I have many uses for this type of solution, but to illustrate here is an example.

      I created a Packing slip with date, origination and destination, but no children. What gets shipped on this Packing slip will be determined later and by someone else using some other program. They will export the list and then "attach" the items to the already created Packing slip.

      I am trying to avoid the solution of pre-processing. (Opening the file, adding in the ParentID to each record in the file and then importing) This would be way to difficult for the users and prone to errors due to file location, permissions and a bunch of other things not worth mentioning. I am just trying to avoid it.

      Could anyone provide direction or suggestions?

      Thanks

       

        • 1. Re: Import Child records into already existing Parent Record
          philmodjunk

          You can do it with "post processing".

          Create the new parent record so that the primary key's value is created.

          Copy the value of this key to a variable.

          Import the records into the child table.

          The imported records generate a found set of imported records. Use Replace field contents with the calculation option and the variable containing the primary key to update the matching foreign key field in the child records.