Hi blackduke77 and welcome to the forum!
There are a couple of ways to do this with code. I will provide some psuedo code below
IXMLDOMNode nParent = thisXDocument.DOM.selectSinglNode( "/my:myFields/my:group1" );
// Create a sample node
IXMLDOMNode nSampleChild = nParent.FirstChild.cloneNode(true);
// Remove the old nodes
((IXMLDOMSelection)nParent.selectNodes( "my:group2" )).removeAll();
// Create new nodes
string[] days = { "M", "T", ... , "S" };
for( int i = 0; i < 7; i++ )
{
IXMLDOMNode nNewDay = nSampleChild.cloneNode(true);
nNewDay.selectSingleNode( "my:Day" ).text = days;
nParent.appendChild( nNewDay );
}
One problem with this is that the node might not be there when you try to make the sample. To solve this you could load the XML from the template.xml:
IXMLDOMDocument tempdom = thisXDocument.CreateDOM();
tempdom.async = false;
tempdom.validationOnParse = false;
tempdom.load( "template.xml" );
If all else fails you can also get the sample node in the OnLoad event, store it in a global variable, and clone it as desired. Hope this helps, good luck!
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge