XMLPort - element value not being brought into NAV?

jversusjjversusj Member Posts: 489
good day all,
I am back with another XMLPort question! i did search the forum, but did not find anything relating to this particular issue.

I have an XML file to import that contains an Element = Extrinsic and Attribute=name. I have defined the XMLPort MinOccurs to Zero for the element since i can receive 0 - 10+ of these in a PO. When i watch my XMLPort through debugger, i am noticing that the Element variable is not pulling in its value, although the attribute is. the problem is, i need the value from the element.

Whew, that sounds confusing. let me show an example.
here is part of my cXML document
<Extrinsic name='PURCHASINGCENTER'>FAIRFAX</Extrinsic>
<Extrinsic name='TAXABLE'>N</Extrinsic>
<Extrinsic name='TANDC'>1) PAYMENT TERMS</Extrinsic>
<Extrinsic name='RELEASENUM'>1</Extrinsic>
<Extrinsic name='ACCOUNTNUM'>ABC123-001</Extrinsic>
<Extrinsic name='EXTERNALPONUM'>286410</Extrinsic>
<Extrinsic name='PODESC'>ORDERING COOL STUFF</Extrinsic>
<Extrinsic name='CONFIRMATIONNUMBER'>EMAIL ADDRESS VALUE</Extrinsic>

in the call behind the name attribute i have the following code (the booleans are place holders while i work on this) ORequestExtrinsicName is the datasource for name attribute and ORequestExtrinsic1 is the datasource of the Element:
IF ORequestExtrinsicName = 'PURCHASINGCENTER' THEN
   ok := TRUE;
IF ORequestExtrinsicName = 'TAXABLE' THEN BEGIN
   IF ORequestExtrinsic1 = 'N' THEN
      InXML."Tax Liable" := FALSE;
   IF ORequestExtrinsic1 = 'Y' THEN
      InXML."Tax Liable" := TRUE;
END;
IF ORequestExtrinsicName = 'TANDC' THEN
   ok := TRUE;
IF ORequestExtrinsicName = 'RELEASENUM' THEN
   ok := TRUE;
IF ORequestExtrinsicName = 'ACCOUNTNUM' THEN BEGIN
   CLEAR(Position);
   CLEAR(tempCust);
   CLEAR(tempShipTo);
   Position := STRPOS(ORequestExtrinsic1,'-');
   IF Position > 0 THEN BEGIN
      tempCust := COPYSTR(ORequestExtrinsic1,1,Position-1);
      tempShipTo := COPYSTR(ORequestExtrinsic1,Position+1,(STRLEN(ORequestExtrinsic1)));
      InXML."Sell-to Customer No." := tempCust;
      InXML."Ship-to Code" := tempShipTo;
   END ELSE BEGIN
      InXML."Sell-to Customer No." := ORequestExtrinsic1;
   END;
END;
IF ORequestExtrinsicName = 'EXTERNALPONUM' THEN
   InXML."External Document No." := ORequestExtrinsic1;
IF ORequestExtrinsicName = 'PODESC' THEN
   ok := TRUE;
IF ORequestExtrinsicName = 'CONFIRMATIONNUMBER' THEN
   ok := TRUE;

when i watch in debugger, i can see the variable populating for the name attribute, but not for the element.
ORequestExtrinsic1 " "
ORequestExtrinsicName "ACCOUNTNUM"

Interestingly enough, i have other Element-attribute pairs in my XMLPort that are functioning correctly. Any thoughts? ](*,)

edit: egads! i fixed it. i moved my code from behind the attribute to behind the element. it was actually going through the attribute code BEFORE it was initializing the element variable. okay. thanks for looking! hope this helps some other rookie out there.
kind of fell into this...
Sign In or Register to comment.