A form below is created using a simple sharepoint list which has the following columns[name, email, permanent address, attachments (inbuild column)]
Now two attachment "datacard" has been added by going to “field” property of the form.
If you click on add "field" you can add multiple "datacards" there.
Now, while submission a form, basically what always happens is all the "datafields" inside the "datacards" gets submitted into the list. So, if you submit this form, you will see only one attachment got submitted.
Now to resolve this we will get all the attachments from the attachments controls and we will first remove the "datafields" from both the attachments.
Then we need to add another form inside that screen and have the same "datasource" as the previous form and add another attachment control there(make sure this form is not visible when you publish the changes). Then inside the "items properties" of that attachment control set a collection.
You can create this collection in "onvisible" property of the screen. But for now, creating and collecting the attachments into the collection in "onselect" properties of submit button. Then simply submitting the main form (which is Form1 here). Then we need to patch the 2nd form (which is Form2 here) data by form. updates function, into the same record by using “Form1.LastSubmit.ID”.
Now if you submit the form you will see all the attachments from both the controls are there inside the list and before the form gets reset if you turn on the visibility of the 2nd form, you will see something like this.
This is the submitted list data.