Need to muliple amount into single event

parth_gupta199
Silver Contributor
Silver Contributor parth_gupta199

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 Pic.PNGAmount 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

kevin_allen
Silver Contributor
Silver Contributor kevin_allen

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