Open jakobkellett opened 5 years ago
Hey @kalberes , I appreciate the labeling of the bug. Is there any updates by chance on this issue? We will be going to the Microsoft Directions Event in Early May (bought a booth!) and hoping we can convert our code from C/AL in time! Thank you~
Hi, I found the same issue with this code in April '19 CU1 : Line is always giving the value of the first node(Line) only...
XmlDoc.SelectNodes('//ShipmentItem', Lines);
if Lines.Count > 0 then begin
foreach Line in Lines do begin
Line.SelectSingleNode('//ItemID/ID', XmlSubNode);
ItemID := XmlSubNode.AsXmlElement().InnerText;
Line.SelectSingleNode('//ShippedQuantity', XmlSubNode);
ShippedQty := XmlSubNode.AsXmlElement().InnerText;
Line.SelectSingleNode('//LineNumber', XmlSubNode);
LineNumber := XmlSubNode.AsXmlElement().InnerText;
message('Line\Item ID = %1\Shipped Qty = %2\Line Number = %3',
ItemID,
ShippedQty,
LineNumber)
end;
end;
Indeed it's working : use ./ItemID/ID for find the node in the current Line.
Replacing the "/" or "//" at the start of each XPath string with the context item expression "." followed by the "/" or "//" did the trick. Glad I found your post.
@atoader Is this going to be looked into
Yes, but I cannot provide an ETA. We have a large number of issues reported through GitHub. We will work on prioritizing issues based on severity and input from developers in the next couple of weeks. We should have an update soon.
Describe the bug
I am calling a web service that returns the following XML:
I have the following local variables:
What is happening is the first iteration processes just fine, but on the second iteration of the foreach is acting strange. The LocalNode appears to allocate correctly, but the LocalNode.SelectSingleNode('//id', LocalValueNode) is grabbing the previous value of LocalNode for some reason.
To Reproduce Steps and/or AL code to reproduce the behavior:
I edited this to be a complete code block for execution.
Expected behavior The iteration should be setting LocalValueNode (XmlNode) to 75a0218f-e111-4b4a-9689-db1b5186b3b6 on the second iteration of the foreach LocalNodeList (XmlNodeList).
Screenshots If applicable, add screenshots to help explain your problem.
Iteration 1 - LocalNode WriteTo Text
Iteration 1 - LocalValueNode WriteTo Text
Iteration 1 - LocalXmlElement InnerText
Iteration 2 - LocalNode WriteTo Text
Iteration 2 - LocalValueNode WriteTo Text
Iteration 2 - LocalXmlElement InnerText
Versions: