• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Quirky NumberFormat issue..

LEGEND ,
Oct 15, 2014 Oct 15, 2014

Copy link to clipboard

Copied

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,

^_^

Views

243

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 15, 2014 Oct 15, 2014

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,

^_^

Votes

Translate

Translate
LEGEND ,
Oct 15, 2014 Oct 15, 2014

Copy link to clipboard

Copied

LATEST

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,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation