I assume I need a script.
You could ask the intern to do it manually …
Anyways, the method I favor captures all productIDs in one variable (ExecuteSQL comes in handy here), and – if records need to be created – the restaurantID in another, goes to the join table and processes the list
Here's a code example for the first approach, which also prevents creating duplicate entries in the join table. After the initial creation, further invocations of that script will simply do nothing, since $toDo will be empty – unless you have added to the product palette in the meantime. But if you want to update all restaurants to a new product, you should create and call a similar script from the product side.
Set Variable [ $already ; List ( JoinTable::productFK ) ]
Set Variable [ $toDo ; ExecuteSQL ( " SELECT productID from Products WHERE productID NOT IN (" & Substitute ( $already ; ¶ ; "," ) & ")" ; "" ; "" ) ]
# assuming your IDs are numeric; string values need to be wrapped into single quotes within the test array
If [ IsEmpty ( $toDo ) ]
# all existing product IDs already have join table entries for this restaurant
Set Variable [ $restaurantID ; Restaurant::restaurantID ]
Go to Layout [ joinTable (joinTable ) ]
Set Variable ( $i ; $i + 1 ]
Set Field [ joinTable::productFK ; GetValue ( $toDo ; $i ) ]
Set Field [ joinTable::restaurantFK ; $restaurantID ]
Exit Loop if [ $i = ValueCount ( $toDo ) ]
Go to Layout [ original Layout ]
You can write this script without using ExecuteSQL(), but then it's a tad more convoluted.
Thank you that helped a lot.