'Initializing an hyperarray parameter agent attribute from a database
I am similar problem to this Initializing an array agent attribute from a database but Im having a problem as it brings back the whole row of data and not only one value.
for( int i=1; i < Modules.size()-1; i++) {
List< Tuple > plan =
selectFrom( Database ).list();
for( int j=1; j < Modules.size()-1; j++) {
Modules.set(i,Database.get(i,j));
//}
}
I would like to set Modules [i] == Database [1,j].
Does anyone have advise on how I can run through the different columns?
Solution 1:[1]
You will have to do something similar to this... use it as a guideline, but you will have to modify it a bit since i didn't test it.
Tuple t =selectFrom( Database ).list().get(0);//first row
int i=1;
Database.getColumns().forEach(col -> {
String colName = col.getMetadata().getName();
if (!colName.equals("al_id")) {
double value=(double)t.get(col);
Modules.set(value,i);
i++;
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
