Home > Back-end >  Initializing an hyperarray parameter agent attribute from a database
Initializing an hyperarray parameter agent attribute from a database

Time:05-02

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?

Modules is a HyperArray Parameter

Database

CodePudding user response:

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  ;
                
            }
        });
  • Related