Correct XPATH Syntax datasource with filter

L

limitlessjb

I have an Infopath form that gets submitted to a Sharepoint form
library. The field values are being overwritten with the default values
everytime the form is opened from Sharepoint.

My default value comes from a web service that returns a value based on
the value in another field. It looks like:

xdXDocument:GetDOM("GetvwEmployees")/dfs:myFields/dfs:dataFields/ns7:GetvwEmployeesResponse/ns7:GetvwEmployeesResult/NewDataSet/Table/utitle[../fullname
= xdXDocument:get-DOM()/my:myFields/my:Employee_Info/my:Name]

Instead, in my OnLoad event, I would like to test if the field is blank
before assigning this default value.

How can I assign this xpath value using code?

Thanks.
 
F

Franck Dauché

Hi,

Use something like:
IXMLDOMDocument3 oSecondDoc =
(IXMLDOMDocument3)thisXDocument.DataObjects["tblTest"].DOM;
oSecondDoc.setProperty("SelectionNamespaces",
"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"
xmlns:d=\"http://schemas.microsoft.com/office/infopath/2003/ado/dataFields\"");
IXMLDOMNode oSecDocNode =
oSecondDoc.selectSingleNode("/dfs:myFields/dfs:dataFields");

Then, to get to fldTest in that secondary document, use:
foreach (IXMLDOMNode oN in oSecDocNode.childNodes)
{
if (oN.nodeType == DOMNodeType.NODE_ELEMENT)
{
IXMLDOMNode oField1 = oN.selectSingleNode("@fldTest");
}
}

Hope that it helps.

Regards,

Franck Dauché
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top