XML file record count returning the wrong value

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

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

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

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++) {