Forum Discussion
YMinaev
13 years agoStaff
Hi,
To create multi-dimensional arrays, you need to declare an array and store arrays as its items. In your case, since you need to create an array of tables, you need to either create an array which will hold arrays which will hold arrays holding the values read from your tables.
For example:
This will create a two-dimensional array where you can store data from your grids. I don't know how they all are named in your application, so, I cannot write a generic loop. Code for saving data from each individual grid will look like this:
As a result, myTableArray holds an array of two-dimensional arrays which store the grid data.
To create multi-dimensional arrays, you need to declare an array and store arrays as its items. In your case, since you need to create an array of tables, you need to either create an array which will hold arrays which will hold arrays holding the values read from your tables.
For example:
...
var myTableArray = new Array();
for(var i = 0; i < 10; i++) // if you have 10 grids
{
myTableArray = new Array();
}
...
This will create a two-dimensional array where you can store data from your grids. I don't know how they all are named in your application, so, I cannot write a generic loop. Code for saving data from each individual grid will look like this:
...
var grid = // Obtain the grid control
for(var row = 0; row < grid.wRowCount; row++)
{
var rowData = new Array();
for(var col = 0; col < grid.wColumnCount; col++)
{
rowData.push(grid.wValue(row, col));
}
myTableArray[/*specify index here*/].push(rowData);
}
...
As a result, myTableArray holds an array of two-dimensional arrays which store the grid data.