Re: Calculate related item Not a Number error
Posted: 14 Aug 2020
Hi Nikita,
here are the screenshots.
Best wishes and a nice weekend
Tom
here are the screenshots.
Best wishes and a nice weekend
Tom
Design SharePoint forms with tabs, complex tables, accordions, sub-lists, and 3rd party columns
https://spform.com/forum/
Code: Select all
fd.relatedItems(6).data('ctx').ListData.Row[0];
Code: Select all
var currency = fd.relatedItems(6).data('ctx').ListData.Row[0].Kosten;
var number1 = parseFloat(currency.replace(/[^0-9,-]+/g,""));
var number2 = parseFloat(currency.replace(/[^0-9,-]+/g,"").replace(",","."));
console.log(number1 );
console.log(number2);
Code: Select all
var currency = fd.relatedItems(6).data('ctx').ListData.Row[0].Kosten;
var number1 = parseFloat(currency.replace(/[^0-9,-]+/g,""));
var number2 = parseFloat(currency.replace(/[^0-9,-]+/g,"").replace(",","."));
console.log(number1);
console.log(number2);
Code: Select all
//Calculate Kosten interner IT Aufwand
var total = 0;
var rows = fd.relatedItems(6).data('ctx').ListData.Row;
rows.forEach(function(item) {
var currencyIT = item['Kosten'];
var numberIT = parseFloat(currencyIT.replace(/[^0-9,-]+/g,"").replace(",","."));
total += numberIT;
total_overall += numberIT;
});
fd.field('Kosten_x0020_IT').value(parseFloat(total.toFixed(2)).toLocaleString("de-DE", {style: "currency", currency: "EUR"}) + ' €');