Home Contact Sitemap Todo Money

Alan K Holden

Accomplished Internaut

Flex and OpenBD Web Services

Flex and OpenBD Web Services

When it comes to packaging data result sets into Web Services (SOAP), Adobe's ColdFusion (ACF) uses a different format than OpenBD.

So your Flex app is expecting a query result which can be cast as an ArrayCollection and used as a data provider. If you switch from ACF to OpenBD, you'll need to do something to reformat the returned structure.

This is what I've used, although never tested on really large sets. Pass in the data object contained within your WebService event.result; and you'll get back the ArrayCollection suitable for use as a data provider.

 

public function openBDQuery2FlexProvider
(openBDQry:ObjectProxy):ArrayCollection
{
        var loopObj:Object = new Object;
        var ACresult:ArrayCollection = new ArrayCollection;
        for (var x:int = 0; x < openBDQry['data'].length; x++)
        {
                loopObj = new Object;
                for (var y:int = 0; y < openBDQry['columnList'].length; y++)
                {
                        loopObj[openBDQry['columnList'][y]] = openBDQry['data'][x][y];
                }
                ACresult.addItem(loopObj);
        }
        return ACresult
}
 

 

As to why this behavior is different, Andy Wu - of New Atlanta - explained to me in a repsonse on the OpenBD Google Group:

"To answer your question Alan, it was implemented with compatibility between our own products BlueDragon and BlueDragon.NET as the priority over compatibility with CF. That was a business decision made by New Atlanta and since open sourcing BlueDragon, the implementation hasn't changed. The compatibility differences are documented in the wiki."

Comments

Post a Comment

Required Field

My Details
Subscription Settings

Hear about status updates or new posts.