Forums
Convert number to comma separated format - Printable Version

+- Forums (https://bdn.bdb.ai)
+-- Forum: BDB Knowledge Base (https://bdn.bdb.ai/forumdisplay.php?fid=13)
+--- Forum: BDB Dashboards Designer (https://bdn.bdb.ai/forumdisplay.php?fid=43)
+---- Forum: BDB Designer Q & A (https://bdn.bdb.ai/forumdisplay.php?fid=16)
+---- Thread: Convert number to comma separated format (/showthread.php?tid=374)



Convert number to comma separated format - Sruthi P - 12-22-2022

How to convert a number to comma separated format? 

Add this in connection script

function numberWithCommas(x) {
     return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}


var cost = changedItem.attributes.data[0].cost_amount;
var cost_comma=numberWithCommas(cost);