Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

populate data in the table

WhatCindy
Level 2
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
Bamboomania
Correct answer by
Level 2
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
Bamboomania
Correct answer by
Level 2
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

WhatCindy
Level 2
Level 2

The code is working good. Thank you very much.

Cindy