CF-SSAS Remoting Server-Side Recordset Manipulation
DIGG IT!
0
Comments
Published
Tuesday, November 04, 2003
at
10:59 AM
.
This remoting method transforms a java.sql.ResultSet into an optimized set of objects for Flash. Thought I would share some today...\0
function getKeywords(){
sql = "SELECT name, id, keywords FROM ad WHERE active = 1 and keywords != 'null'"
rs = CF.query("data001",sql)
//move to first record
rs.first()
//create a hashmap >> maps to Flash Object
complete = java.util.HashMap()
do{
//make an array of strings by delimitng by SPACE
a = rs.getString('keywords').split(' ')
//create another handy HashMap
b = java.util.HashMap()
//add the 'id' value from the recordset as a interger
b.put('id',rs.getInt('id'))
//add the 'name' value from the recordset as a string
b.put('name',rs.getString('name'))
//loop through the array
for (n in a){
//add id and value to the return HashMap
complete.put(a[n],b)
}
//loop until the end of the recordset > next() returns false when at the end of the ResultSet
}while(rs.next())
// send the new object to Flash on the client side.
return complete
}
Cheers,
Ted ;)

0 Responses to “ CF-SSAS Remoting Server-Side Recordset Manipulation ”
Post a Comment