Forum Discussion

ilovechiku's avatar
ilovechiku
Contributor
9 years ago

Adding values to array or map.

I need to add result of a DB query to an Array .Sort the array and print the results. So far, I have this method 

def returntripDB = getEmployeeFromDB(db).toString()

 

public def getEmployeeFromDB(def database)
{
def query = "SELECT Id FROM [myDb].[myDb].[mytable] where co = '1' order by id desc"
def dbreturn = database.rows(query)
return dbreturn.id
}

 

on printing log.info "returntripDB" +returntripDB I have 

returntripDB[6, 5, 4, 3, 29, 2, 1]

 

How can I store this in a array and sort the array?.

 

 

No RepliesBe the first to reply