5 Replies Latest reply on Feb 13, 2009 1:23 PM by ntsiii

    Adobe Flex cutting off decimals?

    CodeFlash05
      Hi, I have an Flex web application where I stream data into to DataGrids with the HTTPService via XML from a database. I am running into the problem of numbers such as 10.00 10.90 are being displayed as 10 or 10.9, so its dropping all the unnecessary 0's

      There are alot of functions to fix this, but I also need this DataColumn to be able to display data formatted like 1:00.00 or 30:02.32. All the functions I have found do not let those stay in their proper format.

      I've been racking my brain for a while on this and tried many solutions, but none havent worked right and I'm hoping someone has an answer otherwise I guess I'll have to scrap the application. Display raw data directly to the application would work too. I have attached some code. Thanks for any help!
        • 1. Re: Adobe Flex cutting odd decimals?
          Level 7

          "CodeFlash05" <webforumsuser@macromedia.com> wrote in message
          news:gmtl0r$stm$1@forums.macromedia.com...
          > Hi, I have an Flex web application where I stream data into to DataGrids
          > with
          > the HTTPService via XML from a database. I am running into the problem of
          > numbers such as 10.00 10.90 are being displayed as 10 or 10.9, so its
          > dropping
          > all the unnecessary 0's
          >
          > There are alot of functions to fix this, but I also need this DataColumn
          > to be
          > able to display data formatted like 1:00.00 or 30:02.32. All the functions
          > I
          > have found do not let those stay in their proper format.
          >
          > I've been racking my brain for a while on this and tried many solutions,
          > but
          > none havent worked right and I'm hoping someone has an answer otherwise I
          > guess
          > I'll have to scrap the application. Display raw data directly to the
          > application would work too. I have attached some code. Thanks for any
          > help!

          Set your resultFormat to e4x


          • 2. Re: Adobe Flex cutting off decimals?
            ntsiii Level 3
            Yup. What is happening is that with the default resultFormat, flex is converting your xml into a tree of dynamic objects. Along the way it is trying to be helpful about converting data types. It is not as smart as it thinks it is.

            e4x is the way to go.
            • 3. Re: Adobe Flex cutting off decimals?
              CodeFlash05 Level 1
              This looks promising, and I hate to sound dumb, but I was going to see if you guys might know where I need to use the resultFormat?

              I'm in a pinch and have a lot of other things going on but really want to get this working...I tried the following and no data came up

              <mx:HTTPService url="Results.php"
              id="xmlFromDatabase"
              showBusyCursor="false"
              result="resultHandler(event)"
              method="POST"
              resultFormat="e4x"
              contentType="application/xml"/>
              • 4. Re: Adobe Flex cutting off decimals?
                ntsiii Level 3
                First, verify your xml in the handler:
                var xmlFromDatabase:XML = XML(oEvent.result);
                trace(xmlFromDatabase.toXMLString()); //does this look liky what you expect?
                Then, get your xmllist:
                var xlData:XMLList = xmlFromDatabase.data.row; //adjust this according to what you see in the trace
                trace(xlData.toXMLString()); //is this your list?
                If that is right, assign that the the DataGrid.dataProvider
                • 5. Re: Adobe Flex cutting off decimals?
                  ntsiii Level 3
                  Also, why are you setting "contentType"?