Highlighted

Need to muliple amount into single event

Silver Contributor
Silver Contributor

Hi All,

Requirement is to add multiple amount into single event. Here amount can be 'n' number. So basically we need to add that and put it into an event.

Amount PictureAmount Picture

I'm using below code to extract the amount using javascript and jquery.

var qwe = $('.dt-right.amt-col').text().split("$");

qwe = ["853.60", "1,299.80", "637.29", "1,940.00"]

Now i need to add above decimal amount which is in array. Can someone help me to add this correctly? 

Not able to add above amount correctly with decimal digits.

 

Thanks

 

1 REPLY 1

Need to muliple amount into single event

Silver Contributor
Silver Contributor

Try something like this


total = 0;
qwe = $('.dt-right.amt-col').text().split("$");
for (let i = 0; i < qwe.length; i++) {
    total = total + parseFloat(qwe[i].replace(/,/g, ''));
}

Kevin Allen SAS-DCX-UXD
User Experience & Data Analytics
DevOps Engineer III
kevin.allen@swisscom.com
Swisscom (Schweiz) AG
www.swisscom.ch