Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Counting Nodes

Avatar

Level 2

Noob question.

This statement:

var nTableLength = TableKM.nodes.length;

is intended to count the child objects (rows) of a table which in my case should be a value of 3.

But the value in the debugger indicates that it is counting the children of the rows which are cells, a value of 6.

Is there a way to limit the counting to immediate child objects?

Thx.

2 Replies

Avatar

Level 10

You want to count the rows as they are the repeating object, not the table. If you had repeating tables your code would work.

And for .length I think you might need to use resolveNodes() (I'm at home now, just going off the top of my head):

var oRows = xfa.resolveNodes("TableKM.Row1[*]");

var nLength = oRows.length;

You can also use the Instance Manager to count:

var nLength = TableKM._Row1.count;

Avatar

Level 2

Thanks a mil.

I'll give it a try on Sunday or Monday.