Welcome, Guest
Username: Password: Remember me

TOPIC: End message script I need to round a percentage down to two places

End message script I need to round a percentage down to two places 2 years 9 months ago #95738

  • pksupport
  • pksupport's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 1
  • Karma: 0
How can I limit a number to 2 decimal places in this code:

Your percentage for Knowledge and skills was:{sum(that.A01.value, that.A06.value, that.A07.value, that.A08.value, that.A12.value, that.A15.value) / 60 * 100} %

Thanks for your time - it's much appreciated.
The administrator has disabled public write access.

End message script I need to round a percentage down to two places 2 years 8 months ago #96857

  • pksupport
  • pksupport's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 1
  • Karma: 0
:( Please!! I have been working hard on this. I can use {floor} but I can't get this to work as I have posted and I need it! Can I pay someone?
The administrator has disabled public write access.

End message script I need to round a percentage down to two places 2 years 8 months ago #96873

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1595
  • Thank you received: 391
  • Karma: 103
Not tried, but probably something like this:
{round(sum(that.A01.value, that.A06.value, that.A07.value, that.A08.value, that.A12.value, that.A15.value) / 60 * 100),2}
BenoƮt
The administrator has disabled public write access.
The following user(s) said Thank You: pksupport

End message script I need to round a percentage down to two places 2 years 7 months ago #96894

  • pksupport
  • pksupport's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 1
  • Karma: 0
THANK YOU!! :cheer:

{round(sum(that.A01.value, that.A06.value, that.A07.value, that.A08.value, that.A12.value, that.A15.value) / 60 * 100),2}

I took off the 2 at the end - was this places? It works. Very very happy as I spent a lot of time on this, so again, thank you very much.

Solution to round down a summed value:

{round(sum(that.A01.value, that.A06.value, that.A07.value, that.A08.value, that.A12.value, that.A15.value) / 60 * 100)}
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.126 seconds