+ Start a Discussion
Arun BalaArun Bala 

Parsing the QueryResult - from Flex

Hello folks,
I am facing a million dollar issue in one of my flex - salesforce mashups based applications.

I need to figure out a way to dynamically construct a array collection(dataprovider for my datagrid) by parsing the QueryResult object.  I was doing something like this ..

                var acRetVal:ArrayCollection = new ArrayCollection();
                for (var j:int=0;j<qr.result.length;j++) {
                     acRetVal.addItem({Email:qr.records[j].Email, Name:qr.records[j].Name,Role:qr.records[j].UserRole.Name});

But I need to do this dynamically so that I can use the same arrayCollection object for any queryExecution.

My problem now is:  I dont know how to retrieve the value for qr.records[j].UserRole.Name.  dynamically since it contains a relationship result, if I give something like

var colName:String = 'UserRole.Name'.
var role:String = qr.records[j].ColName. === > this statement doesnt work. but if I give UserRole.Name, it works.

Any hints on how to overcome this issue ? Help pls ?

Thanks folks,