Using InfoPath 2010, I want to retrieve a value from an xml file based on the value of a field in my InfoPath form. I'm using this queried value to set a field value using a Rule on Form Load.
This hard-coded XPath retrieves the desired value:
xdXDocument:GetDOM("XmlFileName")//GroupB/NodeWithTextValue[@AttributeX='DDD']
In the above XPath string, I'd like to use form field values for 'GroupB' & 'DDD'
Assigning just one value in the path with a form field, this validates using the Verify Formula, but does not set the field value as before:
xdXDocument:GetDOM("XmlFileName")//my:FieldName1/NodeWithTextValue[@AttributeX='DDD']
This also does not work:
xdXDocument:GetDOM("XmlFileName")/RootNode/*[. = xdXDocument:get-DOM()/my:myFields/my:FieldName1]
I've tried several things using the InfoPath function UI to generate the XPath syntax with this filter on a form field, but no success.
Please suggest an XPath syntax that would accomplish this or the steps using the UI to accomplish this.
Thanks
XML structure:
<RootNode>
<GroupA>
<NodeWithTextValue AttributeX="GGG">ValueA1</NodeWithTextValue>
<NodeWithTextValue AttributeX="HHH">ValueA2</NodeWithTextValue>
</GroupA>
<GroupB>
<NodeWithTextValue AttributeX="FFF">ValueB1</NodeWithTextValue>
<NodeWithTextValue AttributeX="DDD">ValueB2</NodeWithTextValue>
</GroupB>
<GroupC>
...
</RootNode>