- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2021 02:34 PM
I have this code in the server side , it is giving the result as 44.0 I want only 44
current.variables.sds_price = parseInt(current.cmdb_ci.market_value)/1024;
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2021 06:49 AM
Please check sample examples from below link , give a try . let me know if it's still not working.
https://stackoverflow.com/questions/7641818/how-can-i-remove-the-decimal-part-from-javascript-number

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2021 02:54 PM
Hi,
You can use:
var priceCalc = parseInt(current.cmdb_ci.market_value)/1024;
var newNum = (""+priceCalc).split('.')[0];
current.variables.sds_price = Number(newNum);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2021 06:39 AM
thanks Allen , still not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2021 07:06 AM
Hi,
Please provide a bit more information as to how it's not working, can you share what you've done. I tested this myself prior to posting it and know it works.
For the other suggestion below, by the other poster, with using Math.round, that is also a viable option...if...you want to actually round the integer. If you're simply wanting to chop off the decimal and any digit thereafter, with no rounding, then what I've mentioned above will do that.
Up to you 🙂
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2021 07:41 AM
Thanks Allen ,
so what I am doing is getting the value for a CI field which is of type integer , for some reason it is populating as 44.0 while setting it to the variable , I tried your code which will act on a variable which will present in Task , when I check in Background script that is displaying without decimal , but via workflow I am getting that decimal value.