Skip to main content
Participant
May 3, 2021
Answered

Changing number format using custom format.

  • May 3, 2021
  • 1 reply
  • 3147 views

Hello,

 

I have a global percentage and several rows with prices. I'd like to have a column next to them with the prices with the percentage applied to them, which is easy to do, but you end up with lots of 0.00 values if a certain row doesn't have any prices.

 

To solve it I'm using the following format script I found here:

event.value = (event.value != 0)?util.printf("€ " + "%,0.2f",event.value):"";

 

The problem is that it formats using a dot (100.00) for decimals, and I'd like a comma (100,00) but have no idea how to accomplish that.

 

If you have any tips I'd greatly appreciate it.

This topic has been closed for replies.
Correct answer Nesa Nurani

Change 0 to 2:

event.value = (event.value != 0)?util.printf("€ " + "%,2.2f",event.value):"";

0 — Comma separated, period decimal point
1 — No separator, period decimal point
2 — Period separated, comma decimal point
3 — No separator, comma decimal point

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 4, 2021

Change 0 to 2:

event.value = (event.value != 0)?util.printf("€ " + "%,2.2f",event.value):"";

0 — Comma separated, period decimal point
1 — No separator, period decimal point
2 — Period separated, comma decimal point
3 — No separator, comma decimal point

PSNickAuthor
Participant
May 4, 2021

Thank you Nesa, worked perfectly!