Expand my Community achievements bar.

SOLVED

Count table rows

Avatar

Level 9

My table does NOT have repeating rows. Using JavaScript, how can I count the number of rows?

var vRows = Table1.Question.count:

1 Accepted Solution

Avatar

Correct answer by
Level 10

Not repeating rows, that's why you get 1... If you have 47 rows with all different names Row1, Row2, Row3, Row4 [...] it is normal you get a count of 1 for each because you do not add instances to a row named Row1 but you have 47 different rows

View solution in original post

7 Replies

Avatar

Level 2

Try using Table1.instanceManager.count();

Avatar

Level 9

I tried Table1.instanceManager.count():

and

Tabel1.Row.instanceManager.count():

and neither worked.

Avatar

Level 10

That is because the count is not a method, it is only a property... remove the '()'

Avatar

Level 9

I tried the following:

this.rawValue = Table1.Row.instanceManager.count;

and i tried...

this.rawvalue = Table1.instanceManager.count;

and the result was 1 for each script but my form has 47 rows (not repeating rows).

Avatar

Correct answer by
Level 10

Not repeating rows, that's why you get 1... If you have 47 rows with all different names Row1, Row2, Row3, Row4 [...] it is normal you get a count of 1 for each because you do not add instances to a row named Row1 but you have 47 different rows

Avatar

Level 1

Hi, Even i am facing this issue. i want the row count. No of rows present in the table.

 

var myTable = xfa.resolveNode("form1.Main.Table1");


var Rows = myTable.instanceManager.count;

this.rawValue = Rows;

 

and

 

var rowObject = xfa.resolveNode("form1.Body.Table1._Row1")

var numRows = rowObject.count;

this.rawValue = numRows;

 

i tried above two scripts but i am getting count as 1 even if there are more rows. 

 

can you please me out

 

 

 

Avatar

Level 10

Hi there,

 

I'm not sure where to start to help you, if you could provide a snippet image of your hierarchy, it would help.

Although, like I said earlier, make sure that you are adding instances to the Row1 object if you are expecting to have a higher number than 1.

If you have many rows within your Table1, but hey are all named differently, you will not be able to get the row count using the count property.

On the other hand, if you have duplicated the object Row1 within Table1 using code such as Table1._Row1.addInstance(1);

or any other way that will duplicate that same row object 'x' number of times, then you can use the count property.

 

I hope this will help.