OL Learn

Currecny SUM from detailed table

Need a total sum for parts in a detailed table.

Use this script for the detailed total sum:
var TotalAmount = “”;
var Amount = “0”;
for(let i=0;i<record.tables.Parts.length;i++){
Amount = formatter.currencyNoSymbol(record.tables.Parts[i].fields.Amount);
TotalAmount += Amount;
}
results.html(TotalAmount);

Have 2 parts with the cost of $1085 and $1085
This gives med TotalAmount = 10851085 as a string.
What am I missing to get the script to calculate it, instead of handling it as a string ?

var TotalAmount = 0;
var Amount = 0;

Still one long string now with leading 0
01,085.001,085.00

var TotalAmount = 0;
var Amount = 0;
for(let i=0;i<record.tables.Parts.length;i++){
Amount = parseFloat(record.tables.Parts[i].fields.Amount).toFixed(2);
TotalAmount += Amount;
}
results.html(TotalAmount);

Thanks ended up with this, to get it formated correct

var TotalAmount = 0;
var Amount = 0;
for(let i=0;i<record.tables.Parts.length;i++){
Amount = parseFloat(record.tables.Parts[i].fields.Amount);
TotalAmount += Amount;
}
TotalAmount = formatter.currencyNoSymbol(TotalAmount);
results.html(TotalAmount );