Page 1 of 1

Double euro symbol

Posted: 04 Aug 2020
by TWendt
Hi,

I have a little problem. I use following script to calculate costs.

//Calculate Consulting
var total = 0;
var rows = fd.relatedItems(4).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Kosten.'])
total_overall += parseFloat(item['Kosten.'])
});
fd.field('Kosten_x0020_Beratungsaufwand_x0').value(Number(total.toFixed(2)).toLocaleString("de-DE", {style: "currency", currency: "EUR"}) + ' €');

The script is okay but two Euro symbols are displayed in the field.

Can you help?

Best wishes
Tom

Re: Double euro symbol

Posted: 05 Aug 2020
by mnikitina
Hello TWendt,

toLocaleString method adds currency symbol when converting number so there is no need to append the euro symbol.

Code: Select all

fd.field('Kosten_x0020_Beratungsaufwand_x0').value(Number(total.toFixed(2)).toLocaleString("de-DE", {style: "currency", currency: "EUR"}));

Re: Double euro symbol

Posted: 06 Aug 2020
by TWendt
Many thanks, it works.

Best wishes
Tom