Hi Shaul,
I have exactly the same situation as u described above.And I used code to implement this.
And most importantly,dont bind the controls in the Order view to the repeating table.Keep separate fields to accept Order details in the Order view.
Assume that my datasource has the following structure
Rootnode
Group
Repeating Group
Steps involved
1)On clicking the "Add Order" button,switch views to the Order view.(Use rules)
2)Keep separate fields in the Order view.
3)For the OK button's OnClick event,Add code to add a row to the Orders repeating table with the new details from the Orders view.
Code sample is
IXMLDOMDocument2 templateDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();
templateDom.validateOnParse = false;
templateDom.load("template.xml");
templateDom.setProperty("SelectionNamespaces", "xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-11-02T09:58:08'");
IXMLDOMNode oTemplateGrp = templateDom.selectSingleNode("/rootnode/group/repeating group");
//Make a copy of ur Repeating Group row.
IXMLDOMNode oTemplateNode = oTemplateGrp.cloneNode(true);
//Transfer the value from the field in Orders view to the field in ur Cloned node.
oTemplateNode.selectSingleNode("fieldname in the repeating group").text=thisXDocument.DOM.selectSingleNode("XPath of the field in your Order view").nodeTypedValue.ToString();
IXMLDOMNode oGroup1 = thisXDocument.DOM.selectSingleNode("/root node/group");
//Finally append the cloned row to the end of the repeating group
oGroup1.appendChild(oTemplateNode);
4)Now switch the view back to the original view from the Orders view using ..
thisXDocument.View.SwitchView("view name");
Regards,
Abhishek