I found what appears to be a generic solution to my problem, but I have
a concern about performance. I hope that someone with (as my daughter
would say) "some skills" can point out the right way of doing this.

My approach is to create a function that will convert any object that
looks like the one in the original post to an ArrayCollection suitable
for use in a DataGrid. Here is what I came up with;

1st Create a dynamic Class like;

package
{
      public dynamic class DynamicClass
      {
      }
}

Next create a function like this;

   private function loadArrayCollection(objIn:Object):ArrayCollection
   {
        var acTmpArray:ArrayCollection = new ArrayCollection;
        for (var i:Number = 0;i < objIn.initialData.length;i++)
        {
            var clTempClass:DynamicClass = new DynamicClass();
            for (var j:Number = 0;j < objIn.columnNames.length;j++)
            {
                 clTempClass[objIn.columnNames[j]] =
objIn.initialData[i][j];
            }
            acTmpArray.addItem(clTempClass);
        }
        return acTmpArray;
   }


Then we call it like this;

[Bindable] public var acPERSON:ArrayCollection = new ArrayCollection

acPERSON = loadArrayCollection(event.PERSON.serverInfo);

and voila we have an arrayCollection that looks and acts remarkably like
one created from a HTTPService result set. I still have more testing to
make sure I can access all of its properties similar to the way the
HTTPService version works.

OK, now that I am done patting myself on the back, there must be a
better way. It seems to me that this would be slow and resource
intensive, and one of the reasons I want to move towards Fluorine is
performance. Besides it just looks like a kludge.



I am very interested in hearing of better ways of doing this without
resorting to hand coding a class for every query I create.



Paul




Reply via email to