cancel
Showing results for 
Search instead for 
Did you mean: 

create a counter for the rows in a table using script editor?

Former Member
0 Kudos

Hi ,

I want to add afield in a particular table with first field is its serial number . How to use scripting editor to fill the serial number ?

How to create a counter ?

Edited by: Rajan.Dexter9 on Jan 30, 2012 9:40 PM

Accepted Solutions (1)

Accepted Solutions (1)

rakesh_m2
Contributor
0 Kudos

Hello Rajan,

Create a field in the table and name it as 'SERIAL'. Create a variable called 'count' with default value as 0. Now in script editor, for javascript language and calculate event, write the following script.

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);

for (var i=0; i <= fields.length-1; i++)

{

if (fields.item(i).name == "SERIAL")

{

count.value = count.value + 1;

this.rawValue = count.value;

}

}

Answers (0)