1 Reply Latest reply on Apr 15, 2011 3:23 AM by LaRetta_1

    Copying multiple records from a parent to child table based on given field value

    wren

      Title

      Copying multiple records from a parent to child table based on given field value

      Post

      I'm hoping someone can help with this. I'm using Filemaker 9 and am having trouble figuring out how to create copies of a record from one table, based on the number of one of the fields, in another table. So, I have 2 tables, 1 parent and 1 child. The parent has the fields: date, time, species, location, and number observed. The child has all of the same fields except instead of NumberObserved it has Individual (which will always be 1). I've also created an auto-entered serial identifier through filemaker, which is how I've joined the tables. Using the value from the 'number observed' field, I want to create that number of copies of the record from the parent table in the child table (all fields except # of individuals). In case my description is confusing: 

      Parent

      Date Time Species  Location NumberObserved UniqueID

      4/5/2000 15:00 coyo fieldA 3 1

      Child

      Date Time Species Location Individual Unique ID

      4/5/2000 15:00 coyo fieldA  1 1

      4/5/2000 15:00 coyo fieldA 1 1

      4/5/2000 15:00 coyo fieldA 1 1

      I'm having difficulty implementing a one-to-many function based on the value in NumberObserved.

      Any help that you could provide would be much appreciated. 

        • 1. Re: Copying multiple records from a parent to child table based on given field value
          LaRetta_1

          Something is wrong in your structure, in that you are duplicating same information from first table ( date, time fieldA ) into a child table.  You should only be transferring the uniqueID from the first table to the second. 

          Then, any time you want to know the values from the first table while in the second, you display the first table's values through the relationship.  This can be accomplished simply by placing the first table's values directly onto the second table's layouts.

          I suggest that you provide a link to a simple example of your base structure with a few dummy records in it so we can see the 1:n relationship (you can upload a sample to a free site such as 4shared.  I suspect you may have the requirements reversed.  At minimum, we need to see a copy of your relational graph, key field names and what other fields exist in that second table (to provide us with example of its purpose).

          If NumberObserved is your child table, my suspicions are increased that the structure isn't quite right.