Velocity script breaking when using "#,###"
Hello,
We are working on a Year in Review email that will pull in customer data through a marekto only field. We are using the code below to pull in all of our data and formatting it to include a comma on the larger numbers:
#set($YIR_most_thank_yousCapped = ${lead.mostThankYousYIR})
#set( $YIR_most_thank_yousFormatted = $number.format( "${esc.h},${esc.h}${esc.h}${esc.h}", $YIR_most_thank_yousCapped ) )
$YIR_most_thank_yousFormatted
As I am discussing this code with our in house developer, he suggested we use "#,###" instead of "${esc.h},${esc.h}${esc.h}${esc.h}" as a best practice using this code below:
#set($YIR_most_thank_yousCapped = ${lead.mostThankYousYIR})
#if($YIR_most_thank_yousCapped && $YIR_most_thank_yousCapped != "")
#set($YIR_most_thank_yousFormatted = $number.format("#,###", $YIR_most_thank_yousCapped))
$YIR_most_thank_yousFormatted
#else
0
#end
When we use this code, however, the email preview breaks. I am wondering why the second code won't register in the email?