1 Reply Latest reply on Oct 15, 2014 12:32 PM by WolfShade

    Quirky NumberFormat issue..

    WolfShade Level 4

      Hello, everyone,

       

      I've got a confusing bit happening, right now.

       

      I'm using SpreadsheetNew() to generate an Excel report AFTER a page with the exact same data is loaded.  (Basically, the data appears, then the page can be resubmit to generate the Excel.. and it's not like the data in the database changing would have an effect - I'm serializing the data to JSON, posting it, then deserializing it back into a query object.)

       

      I've got numbers that appear like "1728074" and I'm dividing them by 12 (to get 144006.1666666667) and using NumberFormat on the display page and it's working just fine.

       

      Trying to replicate the same math and logic for the page that creates the Excel spreadsheet.  The same logic is giving me the same full number (144006.1666666667), but when I apply NumberFormat() (with or without a mask) to that value, it's as if the value is being divided by 1000!  So, instead of getting 144006, it's giving me 144.  That's it.

       

      I'm not applying cell formatting prior to the data being entered, so the default data type of the cells (I think it's "GENERAL") is being used - but I pass val() values, so these are appearing in the spreadsheet as integers or decimals.

       

      What could be causing NumberFormat() to alter the value of the given number??

       

      Thanks, and V/r,

       

      ^_^

        • 1. Re: Quirky NumberFormat issue..
          WolfShade Level 4

          I may have fingered it out.  The value is being sent with commas as thousands-separators.  I think the NumberFormat was tripping on the commas.  I surrounded the value with ROUND() and it's not an issue (at least, so far.. time will tell.)

           

          Thanks, and V/r,

           

          ^_^