XML DOM Management Automation error

jversusjjversusj Member Posts: 489
Hello all,
I searched the forum and didn't find anything quite on point for my issue.
I am trying to figure out how to code using XML DOM. I have been progressively increasing the complexity of the XML file I am creating, attempting to build the file one piece at a time, using the nesting and grouping I require.

My dataset is based on a single table with 5 fields. I need to group on 4 of these fields, so I am using some filtering of the record set to loop. I have to group on Division, Category, SubCategory, and Family, with the fifth field = Item No. I need to create an XML file that will output all Division records by category by sub-category by family. XMLPorts did not seem sufficient for the task.

I have a loop that executes 3 times (for a filtered record set of 5 items in the second filtered category), but at the start of the fourth loop, I get the error:
---------------------------
Microsoft Dynamics NAV
---------------------------
This message is for C/AL programmers:

This Automation variable has not been instantiated.
You can instantiate it by either creating or assigning it.

---------------------------
OK   
---------------------------

If I comment out the loop and let the code run once, everything is okay (although I do not output my full data set), and I get the XML output for 2 items in the first category.

When I watch during debugger, the error is occuring in the AddElement function of CU 6224:
NewChildNode := XMLNode.ownerDocument.createNode('element', NodeName, NameSpace);
The variables (in debugger) appear as they do in the preceding 3 iterations of the loop, which appear to work fine.

any ideas?

How can it be instantiated for the preceding iterations of the loop and suddenly not be at the start of the 4th loop? Thanks!
kind of fell into this...

Answers

  • jversusjjversusj Member Posts: 489
    I may have solved this, or at least got moving again... I removed a CurrNode := currNode.ParentNode which I had several in place to traverse back up to a higher grouping level.
    kind of fell into this...
  • Jether24Jether24 Member Posts: 1
    It is automation error a big problem to the company..
    how cam automatically resolve it?
Sign In or Register to comment.