Hello,
Im looking for the next numeric format: I get the value(targetData.val_generic_2) 50000,98 from the DB
(keep in mind that the dataType (type="") os the variable in our DataScheme is "Double")
In my include I have this:
<%= parseInt(targetData.val_generic_2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") %>
With this parseInt I manage to transform 50000 into 50.000... It's way more estethic. But I need 50.000,98... the comma and the last 2 numeric values.
There's a simple way to do this? I can enhance the parseInt with more parameters or I should do JS inside the include personalization block.
Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @AdobeCampaignProxd ,
Try this,
<%= targetData.val_generic_2.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".") %>
Breakdown:
This should give you the result 50.000,98 as you are expecting.
Thanks
Hi @AdobeCampaignProxd ,
Try this,
<%= targetData.val_generic_2.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".") %>
Breakdown:
This should give you the result 50.000,98 as you are expecting.
Thanks
Thank you very much. Works!
Views
Likes
Replies
Views
Likes
Replies