Hi Guys, Im new to this forum and new to InfoPath...
I have written the function below which uses a secondary datasource(Project Metrics Retrieval) to populate fields in my form. This should match the project name in the form text box with the project name in the SharePoint list, then output the project agreed budget for that project.
Hope my code makes sense(new to coding).
function projectNameEqualsExistingProject()
{
var doc = XDocument.DataObjects("Project Metrics Retrieval").DOM;
doc.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' + ' xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');
var selectedField = XDocument.DOM.selectSingleNode("//my:projectName").text;
var selectedNode = doc.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Project_Metrics_Library/@Project_Name=['selectedField']");
XDocument.DOM.selectSingleNode("//my:ProjectAgreedBudget").text = selectedNode.getAttribute.getNamedItem("ProjectAgreedBudget");
}
The error i get is below:
Expected token 'EOF' found '='.
/dfs:myFields/dfs:dataFields/dfs:Project_Metrics_Library/@Project_Name-->=<--['selectedField']
I would also like to ask if there is a need to put a loop in there to navigate the list and look for the project name, or the this will automatically search for the project name?
Thanks in advance...