views:

28

answers:

1

I have a table in the database:

name         Opinion
Tim          Tim has an opinion
John         other random text
Dan          Dan's random text
Al           Al says something else

I call this data and get it back in

getRecords.lastResult

To access John's opinion, I could use:

getRecords.lastResult[1].opinion

But that's only because I know that John is the second record (record 1), but this may change. So the right way is to search through the results to first find the record index for John, then access his opinion.

My guess is I need some sort of a loop? Is there an easier way to search for John directly without a loop?

A: 

Well if getRecords returns n records and John has to be on one of them you can do it in As3 and do a loop around your Arraycollection until you find John.

Or

Do some server logic to return john data given a search string ("john") if unique.

coulix