Adding commas to values | Community
Skip to main content
Daniela_Puizina
Level 2
Jun 20, 2019 5:52 PM UTC
Solved

Adding commas to values

Sanford Whiteman Hi Sanford - Continuing the discussion here!

So my comma problem - I'm trying to create this script (below) which works but I don't know what to do about adding a comma to the countless values that could be displayed if under 25k. Any ideas?

 

#set ($scorecap = $convert.toNumber(${lead.cap25}))
#if ( $scorecap > 25000)
$25,000
#else
${lead.cap25}
#end‍‍‍‍‍‍
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jun 20, 2019 6:58 PM UTC
#set( $scoreCapped = $math.min($convert.toNumber($lead.cap25),25000) )
#set( $scoreFormatted = $number.format( "${esc.h},${esc.h}${esc.h}${esc.h}", $scoreCapped ) )
${scoreFormatted}‍‍‍

3 replies

Daniela_Puizina
Level 2
Jun 20, 2019 8:31 PM UTC

Thank you!!

Translate
SanfordWhiteman
Level 10
Jun 20, 2019 9:36 PM UTC

Sure, let me know if any of the code isn't self-explanatory.

Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Jun 20, 2019 6:58 PM UTC
#set( $scoreCapped = $math.min($convert.toNumber($lead.cap25),25000) )
#set( $scoreFormatted = $number.format( "${esc.h},${esc.h}${esc.h}${esc.h}", $scoreCapped ) )
${scoreFormatted}‍‍‍
Translate