If I understand well, you want to set the number of instances of InjDiff to the number of instances of Claimants when the "new month" button is clicked... right?
you can use the method setInstances instead of using insertInstance, which will set the number of instances automatically to the number sent in parameter to the method.
So it should look something like the following :
But this will only set instances to one InjDiff subform.. if what you want is to set the instances of InjDiff within each Claimant's subforms, then you will need to loop through each Claimant's subform, like the following
Not quite sure what you are trying to do here, except adding instances to other subforms...
I want to make sure that you are aware that insertInstance method is to add an instance at the index specified, you don't really need to specify the Boolean value as parameter for insertInstance method
Right now each instertInstance methods in the other button is to add an instance at the first position of the subform's list, because you specify 0 as the index parameter.
And the addInstance method in the add new claimant button, is adding an instance at the end of the subform's list
So if you need a subform to be added when you add a new claimant, and your goal is to add that instance at the same position than your claimant's position, make sure to use the same method (addInstance or insertInstance)
if you are using insertInstance, make sure both subforms insert an instance at the right position with the index specified as the parameter