I have been working on trying to convert the Web Service result from
Blue Dragon to a usable, bindable ArrayCollection for a while now. I
think I have come up with a solution for a function that will do it for
me, but I just can't get it right. Maybe someone could help. I am
returning the data from the Web Service as Objects (returnformat) and
have been able to attach them to a datagrid by using their index
numbers.

I attached 2 images to this email. One of the returned
ArrayCollection of column names (columnList) and the other of the
values (data). I want to create an ArrayCollection that has the column
names matched with their values for each record row returned.

Here is the function I have so far:

        public function convert(total:int, columns:ArrayCollection, 
data:ArrayCollection):ArrayCollection {

            var AC:ArrayCollection = new ArrayCollection();

            for(var i:int = 0; i < total; i++) {

                var row:Object = new Object();

                for (var r:int; r < columns.length; r++) {
                    row += [columns[r] = data[i][r]];
                }
                AC.addItem(row);
            }
            return AC;
        }

total is the length of the event.result which is being passed in. columns is 
the ArrayCollection (e.result.columnList) and data is the ArrayCollection 
(e.result.data);

Reply via email to