0

I'm populating an advanceddatagrid through a http service call. I define a HTTPService in my mxml file like this:

<mx:HTTPService id="srvReadMicroData"/>

It receives this simple "XML file" ...

<MicroDataSet>
  <Row arb_id='982215013000269378' />
</MicroDataSet>

... through these functions:

public function readMicroData():void
{
  ...
  srvReadMicroData.url = myUrl;
  srvReadMicroData.method = "POST";
  srvReadMicroData.addEventListener("result", httpReadMicroDataResult);
  srvReadMicroData.send();
}

public function httpReadMicroDataResult(event:ResultEvent):void {
  myGrid.dataProvider=srvReadMicroData.lastResult.MicroDataSet.Row;
  myGrid.validateNow();
}

When I run debug in Flashbuilder and look at the value of the http service, the last three digits is different. The value changes again when I do a toString(). It seems to happen with large numbers:

srvReadMicroData.lastResult.IseeMicroDataSet.Row["arb_id"] --> 982215013000269440 srvReadMicroData.lastResult.IseeMicroDataSet.Row["arb_id"].toString() --> 982215013000269300

Any ideas on how to solve this?

Jan Sander
  • 35
  • 7

2 Answers2

0

it seems that the value you're trying to get is larger than Flex maximum one, so it rounds it. You could add a "A" letter at the begin of your 'arb_id' string in this way:

<MicroDataSet>
    <Row arb_id='a982215013000269378' />
</MicroDataSet>

In this way, flex gets the 'arb_id' object as a String. Then you can substring it removeing the 'a' character. Finally you will have a string representing exactly the value in your xml.

Hope to have been helpful

marcocb
  • 241
  • 3
  • 10
0

If srvReadMicroData.lastResult contains XML data, then you can process as below:

private var _xml:XML;
[Bindable]
private var rowArrayCollection:ArrayCollection = new ArrayCollection();
public function httpReadMicroDataResult(event:ResultEvent):void {
    _xml = XML(srvReadMicroData.lastResult);
    for each (var row:XML in _xml.Row) {
        var rowObject:Object = new Object();
        rowObject.arb_id = row.attribute("arb_id");
        //trace("rowID: " + rowObject.arb_id);
        rowArrayCollection.addItem(rowObject);
    }
    myGrid.dataProvider = rowArrayCollection;
}
gbdcool
  • 974
  • 7
  • 18
  • This code is not working with my data. However, it is possible for me to change the file format. How should it look like? – Jan Sander Dec 11 '14 at 11:40
  • You may want to go through these: http://help.adobe.com/en_US/Flex/4.0/AccessingData/WS2db454920e96a9e51e63e3d11c0bf69084-7fdd.html http://help.adobe.com/en_US/flex/accessingdata/WS2db454920e96a9e51e63e3d11c0bf69084-7fdc.html – gbdcool Dec 11 '14 at 17:47