How to calculate the number of row in a dynamic table | Community
Skip to main content
Jan 15, 2008 4:41 PM UTC

How to calculate the number of row in a dynamic table

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 3
Nov 20, 2008 9:00 AM UTC
Hi Robert,



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



Regards,

Zoe
Translate
Jan 21, 2008 9:35 AM UTC
Hi Robert,



It works,

thanks a lot.



Pascal.
Translate
Level 3
Jan 18, 2008 4:44 PM UTC
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);
Translate