How to calculate the number of row in a dynamic table | Community
Skip to main content
January 15, 2008

How to calculate the number of row in a dynamic table

  • January 15, 2008
  • 13 replies
  • 12871 views
Hi,

I've got a dynamic table where rows can be added by the user, in each row there's a checkbox cell. At the end of the table there's a "fixed" row where I have to count the number of the checked dynamic rows. How can I do that?



Thanks for your help.

Pascal.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

13 replies

Level 2
November 20, 2008
Hi Robert,



how would I count the occurances of a field value = true ON A PAGE?



Regards,

Zoe
January 21, 2008
Hi Robert,



It works,

thanks a lot.



Pascal.
New Participant
January 18, 2008
You can add in a for loop using javascript. This loop will go through each row and check the value of the field and then add that to an incrementing variable. Below is some example code.



//rowIM is the instance Manager for the row

var rowIM = xfa.resolveNode("Form.Page.Table.Row").instanceManager;



var checkedCount = 0;



//Go through each item

for(var i=0;i<rowIM.count;i++)

{

//Check the field value to see if it is checked

if(xfa.resolveNode("Form.Page.Table.Row[" + i + "].CheckField").rawValue = 1)

{

checkedCount++; //Increase the check count

}

}



xfa.host.messageBox('Checked fields: ' + checkedCount);