Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!
SOLVED

populate data in the table

Avatar

Level 2

Hi,I have the problem about coding when I use the array to display the data in the table. I don't know what I am missing in the code, the data is only displayed in the first row, and second row is displayed empty. I have spent a lot of time to figure the solution however I am not successful.

I need your help. Thank you.

Here is the coding which places in the button: click

var part1 = new Array("A","3",78,9)
var part2 = new Array("E","2",45,8);
var part3 = new Array("C","1","14",9);

var b = new Array("",part1,part2,part3)

var a = new Array()
a[0]=form1.page1.Table1.Row1.TextField1;
a[1]=form1.page1.Table1.Row1.TextField2;
a[2]=form1.page1.Table1.Row1.TextField3;
a[3]=form1.page1.Table1.Row1.TextField4;

a[4]=form1.page1.Table1.Row2.TextField5;
a[5]=form1.page1.Table1.Row2.TextField6;
a[6]=form1.page1.Table1.Row2.TextField7;
a[7]=form1.page1.Table1.Row2.TextField8;

a[8]=form1.page1.Table1.Row3.TextField9;
a[9]=form1.page1.Table1.Row3.TextField10;
a[10]=form1.page1.Table1.Row3.TextField11;
a[11]=form1.page1.Table1.Row3.TextField12;
  
for (var i=0; i<a.length; i++){
for (var j=0;j<b.length; j++){
a[i].rawValue=b[j][i] ;
}

}

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi,

Try this.

var i=0;
for (var j = 0 ; j < b.length ; j++){
for (var k = 0 ; k < b[0].length ; k++){
  a[i].rawValue=b[j][k] ;
  i++;
}
}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

Hi,

Try this.

var i=0;
for (var j = 0 ; j < b.length ; j++){
for (var k = 0 ; k < b[0].length ; k++){
  a[i].rawValue=b[j][k] ;
  i++;
}
}

Avatar

Level 2

The code is working good. Thank you very much.

Cindy