+ Start a Discussion
wongtwongt 

Need help with Adobe Flex SOSL

I apologize for this totally newbie question, but I've exhausted all manuals and google, tried all possible combinations, but I'm stuck. I feel like an idiot for even having to ask, but any help is greatly appreciated.

 

Here's the code --

 

 

//PART 1: The search -
force.search("FIND {test} IN ALL FIELDS RETURNING Contact(id, firstname)", new AsyncResponder(searchHandler));

// ... some code here

//PART 2: searchHandler -
var srArray:ArrayCollection = new ArrayCollection();
srArray = result.searchRecords;
var count:int = 1;
for(var i:int=0; i<srArray.length; i++) {
//None of these worked

//var a:SObject = srArray[i].getFields()[0].record;
//var a:SObject = srArray[i].getFields()[0].Contact;
//var a:SObject = srArray[i].getFields()[0].Name;
dpArray.addItem(
{
No:count,
Name:srArray[i].getFields()[0].toString() //This returns a display of a list of 'record'
}
);
count++;
}

//This returns a display of a list of '[object Object]'
//grid.dataProvider = result.searchRecords;

 

Here's an example of what I'm getting from the code attempts above --

 

 

 

The question is -- how do I get the labels and values out of the collection?

 

Thanks in advance ..

Message Edited by wongt on 10-01-2009 10:09 PM
wongtwongt

Ok, I am an idiot. The answer was pretty simple --

 

 

for(var i:int=0; i<srArray.length; i++) { var a:SObject = srArray[i].record; dpArray.addItem( { No:count, Id:a.id, Name:a.FirstName } ); count++; }