I have a two-dimensional array containing strings, structured like this:
[["Application1", "11106.exampleserver.com", "11109.exampleserver.com", "11102.exampleserver.com", "11105.exampleserver.com" "Database, AFPUOR(KNAJKLD)", "Database, UOQZRNJ(LKUJD)" ],
["Application2", "44407.exampleserver.com", "11106.exampleserver.com", "11104.exampleserver.com", "Database, POJPR (OIUOLWA) ", "Database, UIAHSD (JJJQEP)" ],...]
And so on.. Each time with a different number of servers and databases.
I am looking for the best way to sort the applications by database/server and display or save this information. How should I manage this array?
To achieve this, I require an HTML table: The table header should display the application name followed by the respective servers and databases (separated).
Currently, I can extract the Databases using this code:
for(j=0; j < columns.length; j++){
for(i=0;i < columns[j].length; i++){
var db = columns[j][i].match("Database")
if (db != null){
console.log("APP: " + j + ": " + columns[j][0] + " , ID: " + i + ": " + db.input)
//outputs for example: APP: 0: Application1, ID: 5: Database XYZ
}
}
}
And for extracting Servers, I use the following code:
for(j=0; j < columns.length; j++){
for(i=1;i < columns[j].length; i++){
var db = columns[j][i].match("Database")
if (db == null){
console.log("APP: " + j + ": " + columns[j][0] + " , ID: " + i + ": " + columns[j][i])
//outputs for example: APP: 0: Application1, ID: 1: Server1.1
}
}
}