The best way is to set resultFormat="e4x".  The default resultFormat
("object") causes Flex to convert the xml into a tree of nested objects.  In
this case, if there are multiple sub nodes, Flex knows to create an array,
but if there is only one node, it just has to create a single object.

 

You can test result using, if I recall correctly, "if (result is Array)".

 

But best practice is to use e4x and then build your ArrayCollection of own
strongly typed VOs.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of criptopus
Sent: Sunday, January 10, 2010 9:05 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Single Record Tables

 

  

I have a table with a single record in it and I've been trying to read it
with not too much luck. Tried a couple of ideas one was using try and catch
which seemed to work but has stopped working for some unknown reason. This
is my latest attempt to load an ArrayCollection.

Anybody got any suggestions?

if (event.result.response.data != null)
{
if (event.result.response.data.row[0].usrid)
{
// Deal with many rows
memberData=event.result.response.data.row as ArrayCollection;
}
else
{
// Deal with a single row.
var rcd:Object=new Object();
rcd.usrid=event.result.response.data.row.usrid;
rcd.grpid=event.result.response.data.row.grpid;
rcd.membstatus=event.result.response.data.row.membstatus;
memberData=new ArrayCollection();
memberData.addItem(rcd);
}
else
{
// Deal with no rows.
memberData=new ArrayCollection();
}



Reply via email to