Hello!
Just migrated from FM6 to 12 and am enjoying all the power and flexibility!
I have two tables (Materials and Restrictions) that are "joined" in a many to many relationship through a third table (MatRest_JOIN). The primary table contains information on organic materials, the second table is a listing of all the possible restrictions a material might have. That middle, joined table which allows the many to many relationship can be understood as...
1. A material can have one or many restrictions
2. A restriction could apply to one or many materials at one time
3. MatRest_JOIN table has an index (ID) of it's own records and then for each record has the fields MaterialID and the RestrictionID
At present, I can select one restriction at a time to be added to the joined MatRest_JOIN table via a portal. However what I'd like to give user's the ability to do is see a list of ALL the restrictions possible, choose via a checkbox beside each of the ones they want and then add all those restrictions in one step to the joined table. So back in my main layout for Materials that has the Restrictions portal, they'd see all the restrictions they chose/applied to that organic material.
I do have a couple ideas how to accomplish this, such as a loop in the script that looks at each record in the Restrictions table to see if the user checked it....then as it comes across those, it creates a new record in the joined table tying the ID's of the Materials and Restrictions table records, then it continues through the Restrictions list performing the same task until it hits the last record.
That seems like the way to do it, however it also seems like a might be a big clunky...going step by step through one table (which at most would only ever have like 30 records/restrictions in there) and checking a flag, and creating a new record in the joined table, on and on.
Any thoughts are greatly appreciated...thanks so much!
Joshua
FM12_Script_MultipleRestrictions.pdf