Highlighted

XML file record count returning the wrong value

Thomas_McConnac

13-01-2009

Hi all,



I'm using an XML schema, and an XML data file to load 3240 records into my form.



When I use "xfa.datasets.data.Users.nodes.length" however, it is saying that there are 3255 records.



I have a separate fragment that looks at the same file that returns 3240 records on its own, but when placed into my form is somehow finding 3255 records.



Any ideas from anyone?



Many thanks,



Tom

Replies

Highlighted

pguerett

13-01-2009

There are additional nodes that we add for the MasterPages and the referenced objects. You can visually see what you are getting by create a large field (multiline of course) and add a button to thr form. On the click event of the button add the code:



TextFieldName.rawValue = xfa.datasets.data.saveXML("pretty");



This will dump the datadom structure into that field so you can see it. Count the extra nodes that you see and you will see where the extr 15 nodes come from.
Highlighted

Thomas_McConnac

14-01-2009

Ah, I see. It's adding an entry for every subform I have under the main form.



Seems a bit bonkers, but I'm sure you have your reasons. Guess I'll have to count them and take that many off automatically in my script.



Tom
Highlighted

Thomas_McConnac

14-01-2009

Right then, my solution:



var nodesToRemove = 0;



for (var nodeCount = 0; nodeCount < RFC.nodes.length ; nodeCount++) {



if (RootForm.nodes.item(nodeCount).className == "subform") {



nodesToRemove++;

}//end of if

}//end of for



for (var i = 0; i < xfa.datasets.data.Users.nodes.length -nodesToRemove && l_MatchFound == false; i++) {