- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
The XML structure is the same as what I posted above.
Here is my code that I use to extract out the full_name and employee_id:
--------- Begin Code -------------
//Parse out XML from text field.
var myXML = XMLData.parse(xfa.resolveNode("topmostSubform.Page1.subformStatChngForm.subformEmployeeData.subformEmplChanges.txtXMLString").rawValue, false);
//Get the node count of subordinates for the For loop.
var nodeCount = myXML.Subordinates.nodes.length;
//Message box is just for debugging
xfa.host.messageBox("There are " + nodeCount + " nodes!");
//Loop through and add all the Full Name and Employee ID to the Dropdown List. The Employee ID is used as an index.
if (nodeCount.value == -1) {
//No direct reports
xfa.host.messageBox("You do not have any direct reports...!");
} else if (nodeCount.value > 0) {
//Not an array, just a single direct report
topmostSubform.Page1.subformStatChngForm.subformEmployeeInfo.txtStatEmplName.addItem(myXML.Subordinates.nodes.item(0).nodes.item(3).value, myXML.Subordinates.nodes.item(0).nodes.item(0).value);
} else {
for(var i=0; i<nodeCount; i++){
try {
topmostSubform.Page1.subformStatChngForm.subformEmployeeInfo.txtStatEmplName.addItem(myXML.Subordinates.nodes.item(i).nodes.item(3).value, myXML.Subordinates.nodes.item(i).nodes.item(0).value);
}
catch(e){}
}
}
--------- End Code -------------
Thanks!
John
Views
Replies
Total Likes