Hi Emin,

this is JavaScript function that you were looking for:

var gdb = orient.getGraphNoTx();
var list = gdb.command( "sql", "select expand(in('link_to_school')) from 
Scuola");

var start;
var scuola;
var lista;
var end;
var loadlist = 0;

var nomepersona
var nomescuola

for(i=0; i<list.length; i++) {
  
  start = list[i].getId().toString()+"";
  scuola =  gdb.command( "sql",  "select in from link_to_school where out = 
'"+start+"'");
  end = scuola[0].getProperty("in").getId().toString()+"";    
 
  if(loadlist == 0) {
    
    loadlist = 1;
    nomepersona =  gdb.command( "sql",  "select name from persona where 
@rid='"+start+"' ");
    nomescuola =  gdb.command( "sql",  "select nameschool from scuola where 
@rid='"+end+"' ");
    
    lista = nomepersona[0].getProperty("name") +" --> "+ 
nomescuola[0].getProperty("nameschool") +"; ";
        
  } else {
     nomepersona =  gdb.command( "sql",  "select name from persona where 
@rid='"+start+"' ");
     nomescuola =  gdb.command( "sql",  "select nameschool from scuola 
where @rid='"+end+"' ");
    
    lista = lista + nomepersona[0].getProperty("name") +" --> "+ 
nomescuola[0].getProperty("nameschool") +"; ";
  } 
  
}

return lista;


The result returned is

<https://lh3.googleusercontent.com/-sp2cT4FO2xg/VW8MVBrAQ9I/AAAAAAAAABk/hFKdLlcumfI/s1600/function.jpg>


Regards,

Luigi S.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to