Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Need help appending data to xml dataset from web service

Avatar

Former Community Member

I have a form with 2 drop downs and a fill in. All get data from a web service I created. The drop downs get their data from this xml that is populated in a couple of text fields:

Dropdown1txtfield:

<?xml version="1.0" encoding="utf-8" ?>
  <string xmlns="pardata"><clsStaffInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">"<EMPLOYEE_ID>123456789</EMPLOYEE_ID><name>PUBLIC, JOHN Q</name></clsStaffInfo></string>

<?xml version="1.0" encoding="utf-8" ?>

Dropdown2txtfield:
  <string xmlns="pardata"><clsSupervisorInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">"<EMPLOYEE_ID>987654321</EMPLOYEE_ID><Supervisor_Name>ANYMAN, JOHN T</Supervisor_Name></clsSupervisorInfo>

The third takes input from a text field (Employee ID), submits to the webservice and returns this to another text field:

<?xml version="1.0" encoding="utf-8" ?>
  <string xmlns="pardata"><clsEmployeeInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">"<Index>SMITH1234</Index> <EM_EMPLOYEE_ID>987651234</EM_EMPLOYEE_ID> <FIRST_NAME>JOHN</FIRST_NAME> <MIDDLE_INIT>Q</MIDDLE_INIT> <LAST_NAME>SMITH</LAST_NAME> </clsEmployeeInfo></string>

My problem is trying to append the returned XML to the dataset. I'm using this code to populate the staff drop down list:

xfa.datasets.loadXML(xfa.resolveNode("definitions.#subform.GetStaffResult").rawValue

, false, false);

//test

XMLdata.rawValue

= xfa.datasets.saveXML("pretty");

var theDataGroup = xfa.datasets.string.clsStaffInfo.nodes;

var oNodes = xfa.datasets.string.clsStaffInfo.nodes;

var nodesLength = oNodes.length;

//xfa.host.messageBox(len);

var

ddlist = xfa.resolveNode("definitions.#subform.reviewer");

ddlist.clearItems();

ddlist.rawValue

= "";

for

(var i = 1; i < 18; i++) {

ddlist.addItem(theDataGroup.item(i

+1).value,theDataGroup.item(i).value);

//xfa.host.messageBox(theDataGroup.item(i).value + " " + theDataGroup.item(i + 1).value)

i

= i + 1

}

definitions.#subform[0].reviewer::change - (JavaScript, client)

xfa.resolveNode("definitions.#subform.ReviewerName").rawValue

= xfa.event.newText;

xfa.resolveNode("definitions.#subform.Reviewer_ID").rawValue

= xfa.resolveNode("definitions.#subform.reviewer").boundItem(xfa.event.change);

When I try to run this code for the second drop down (using

var theDataGroup = xfa.datasets.string.clsSupervisorInfo.nodes;

var oNodes = xfa.datasets.string.clsSupervisorInfo.nodes;

in place of the clsStaffinfo lines) I get nothing in the list.

I get nothing for the employee info either.

How do I append the second and third XML Loads to the first?

0 Replies