Rounding dollars on a widget
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 10:37 AM
I have a widget on my standard dashboard that shows a sum total dollars from a table. Is it possible to format this in the widget to only show whole dollars? It doesn't appear to support value formatting for Sum figures
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 11:52 AM
Hi, unfortunately with no clear details of your configuration specific details are not possible, but I would expect that one of the math functions, toFixed() or parseInt() will provide the result you require.
var test = 21.62345;
var myResult1 = Math.round(test);
var myResult2 = Math.floor(test);
var myResult3 = Math.ceil(test);
var myResult4 = test.toFixed(0);
var myResult5 = parseInt(test);
gs.info('round ' + myResult1);
gs.info('floor ' + myResult2);
gs.info('ceil ' + myResult3);
gs.info('toFixed ' + myResult4);
gs.info('parseInt ' + myResult5);
JavaScript Math Object (w3schools.com)