I'm new to repeating tables and C# so I'm hoping I can get some guidance
I am designing a form which reads items from a SP custom list called TestCustomList. This form needs to associate all the items in the list with an ID generated by the form (forming a many to one relationship). This is just a test prototype, the actual form will need to populate other fields besides the ID.
The way I plan to go about this is to create a repeating table and bind it to TestCustomList directly and hide it within a section. I will create another (local) repeating table and use C# code to copy from the SP bound rpt table to the local one.
http://www.bizsupportonline.net/infopath2007/copy-rows-from-sharepoint-list-to-main-data-source.htm
I plan to use this in conjuction with C# code which will allow me to submit a repeating table to a list:
http://www.bizsupportonline.net/infopath2007/how-to-submit-items-rows-repeating-table-infopath-sharepoint-list.htm
I have uploaded the C# code that I am using. I needed to write something to the other fields in the repeating table otherwise when I load the form, the fields that I don't modify, become read-only in the form. So in the screenshot, I only write to field1, field2 and field5 have been commented out. When I load the form field2 and field5 are read only. If i uncomment the code, when I load the form these fields are writable. Do I need to write a blank character to every field I don't want to populate or is there a better way?
Also, if I use C# to populate a field in the repeating table, will that prevent the trigger of a rule to set the field in the second column of the repeating table? Currently the rule is not populating the second column in the repeating table when the form loads. After I uncomment the lines as described above, the form still does not auto populate field2. However if I trigger a changed event on field1, field2 is populated via the rule.
Rule XPath:
xdXDocument:GetDOM("TestCustomList")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID[../d:Title = current()]
Thanks