T
TimPGade
FYI - My schema is at the end of this message.
I am trying to compose my Main xml from a secondary data source using VB
managed code and cannot find a way to add repeating members via code. I have
tried several/all of the suggestions I could find in this DG but am still not
having success.
Here is my problem.
In my form, I have a Repeating section (SectionChildren) with an Optional
section (SectionOptionalAMCodes) that has a Repeating table
(SectionChildAMCodes).
SectionChildren [RepeatingSection]
SectionOptionalAMCodes [Optional section]
SectionChildAMCodes [Repeating table]
In my load data, I have a household with multiple (0-many) children with
variations of the above data that I would like to add/insert into my xml and
and build into my form on AfterChange so the data is displayed.
I have an AfterChange event tied to a picklist dropdown that I use to fetch
external data into my Secondary and load it into my Main data source. I have
tried numerous suggestions from these threads to select and clone the
SectionChildren node and add the underlying elements to the clone and then
append the cloned node to the original node.
But I can't get any of them to work and I am sure I am overlooking something.
I have also tried the ExectueAction approach
thisXDocument.View.ExecuteAction("xCollection::insertAfter", "group18_55")
where group18_55 is the repeating SectionChildren.
I get this error message
System.Runtime.InteropServices.COMException
The specified bstrAction value for the View.ExecuteAction call is not
applicable for the current selection.
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.ExecuteAction(String
bstrAction, Object varXmlToEdit)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.ExecuteAction(String bstrAction, Object varXmlToEdit)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.ExecuteAction(String bstrAction, Object varXmlToEdit)
at Form453.Form453.FormID_OnAfterChange(DataDOMEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnAfterChange(DataDOMEvent pDataDOMEvent)
<xsd:element name="SectionChildren">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildName" minOccurs="0"/>
<xsd:element ref="my:SectionOptionalAMCodes" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildName">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildFirstName" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildFirstName" type="xsd:string"/>
<xsd:element name="SectionOptionalAMCodes">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:SectionChildAMCodes" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SectionChildAMCodes">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildAMCode" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildAMCode" type="xsd:string"/>
I am trying to compose my Main xml from a secondary data source using VB
managed code and cannot find a way to add repeating members via code. I have
tried several/all of the suggestions I could find in this DG but am still not
having success.
Here is my problem.
In my form, I have a Repeating section (SectionChildren) with an Optional
section (SectionOptionalAMCodes) that has a Repeating table
(SectionChildAMCodes).
SectionChildren [RepeatingSection]
SectionOptionalAMCodes [Optional section]
SectionChildAMCodes [Repeating table]
In my load data, I have a household with multiple (0-many) children with
variations of the above data that I would like to add/insert into my xml and
and build into my form on AfterChange so the data is displayed.
I have an AfterChange event tied to a picklist dropdown that I use to fetch
external data into my Secondary and load it into my Main data source. I have
tried numerous suggestions from these threads to select and clone the
SectionChildren node and add the underlying elements to the clone and then
append the cloned node to the original node.
But I can't get any of them to work and I am sure I am overlooking something.
I have also tried the ExectueAction approach
thisXDocument.View.ExecuteAction("xCollection::insertAfter", "group18_55")
where group18_55 is the repeating SectionChildren.
I get this error message
System.Runtime.InteropServices.COMException
The specified bstrAction value for the View.ExecuteAction call is not
applicable for the current selection.
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.ExecuteAction(String
bstrAction, Object varXmlToEdit)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.ExecuteAction(String bstrAction, Object varXmlToEdit)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.ExecuteAction(String bstrAction, Object varXmlToEdit)
at Form453.Form453.FormID_OnAfterChange(DataDOMEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnAfterChange(DataDOMEvent pDataDOMEvent)
<xsd:element name="SectionChildren">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildName" minOccurs="0"/>
<xsd:element ref="my:SectionOptionalAMCodes" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildName">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildFirstName" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildFirstName" type="xsd:string"/>
<xsd:element name="SectionOptionalAMCodes">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:SectionChildAMCodes" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SectionChildAMCodes">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="my:ChildAMCode" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ChildAMCode" type="xsd:string"/>