This question was answered by you before some times as I searched the community. I tried to copy the script as you advised but could not get the correct results. It only increased the counter of records in hundreds of thousands but actually record are just one or two and 54 in the portal.
Anyway my case is very simple. The database is for a milk distributor who deliver it to about 30 customers morning and evening. Now instead of entering all customers name by selecting them in portal and enter their quantity daily 2 times, it is preferred to just duplicate the previous record as the quantity for each customer is almost same in all records.
There are three tables, "Customers", "Milk Records" and "Milk Productions".First two are parents and last one is child, have two foreign keys. Milk Records have only "IDpk" and "Entry Date" field. Its portal is Milk Productions which have "CustID" taking from Customer table and "Qty" field.
It is required to create a record in parent layout Milk Records with a date and then fill all customers IDs in the portal (table Milk Productions). Next day instead of fill all customers ID again, it is better to press a button and a new record be created in parent layout with all the records of portal.
If you could answer my question by coping your previous script according my tables, it would be great favor.