SOLVED

Adding commas to values

Go to solution
Daniela_Puizina
Level 1

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
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Adding commas to values

#set( $scoreCapped = $math.min($convert.toNumber($lead.cap25),25000) )
#set( $scoreFormatted = $number.format( "${esc.h},${esc.h}${esc.h}${esc.h}", $scoreCapped ) )
${scoreFormatted}

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Adding commas to values

#set( $scoreCapped = $math.min($convert.toNumber($lead.cap25),25000) )
#set( $scoreFormatted = $number.format( "${esc.h},${esc.h}${esc.h}${esc.h}", $scoreCapped ) )
${scoreFormatted}
Daniela_Puizina
Level 1

Re: Adding commas to values

Thank you!!

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding commas to values

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