4 Replies Latest reply on Dec 16, 2015 7:42 AM by mikebeargie

    Scripted Addition of Records in Many-To-Many Relationship

    jkostenbader

      Hello All...

       

      Need some scripting guidance to help automate this process. Consider a classic many-to-many between  Employees and Comments. Each employee could have many comments and each comment could potentially apply to more than one employee. These are glued together using a joinEmployeeCommens table with ID_Employee, ID_Comments and ID_Join_EmployeeComments

       

      The problem I'm trying to solve using scripting is on the comments layout. When I have a comment that applies to more than one employee its tedious at best to enter each employee in the portal on comments layout that this might apply to. More often than not I'm applying a comment to a certain department of employees. What I'd like to do is have a simple button that reaches into the employees table, does a quick find by department and add let's say all the project managers to this particular comment. Here's what I've come up with thus far:

       

      12-16-2015 8-28-17 AM.png

      Problems:

      1. When I run this, I'm getting "?" marks in the tblJoinEmployeeComment table for ID_Comment and ID_Employee. Somehow I think I'm loosing my context for some of these variables along the way. I don't have a copy of advanced to step through these (bummer)

      2. I"m not entirely sure this is the most efficient way to do this (I'm a relatively new developer to filemaker)

      3. The last script step is a complete guess on my part. Somehow once all this is done I want to refresh the portal. The idea being that the full name (which sets on top of the ID_Employee on the portal) shows up.

       

      Any guidance for a new guy would be appreciated

       

      Regards

       

      John