The following script works up to the 6th record then fails every time on the 7th and stops the form from being submitted with an error.
The attached screen shots are from the same page but it was too long so I had to capture into several consecutive images. There was a 4th image but just found that 3 attachments are max.
Code to pass Country to Subform record:
row.Country = input.Country;
churchlist = Churches [Country == input.Country];
clear row.Church;
row.Church:ui.append(churchlist.Church.getall());