Hello Community!
I am tasked with finding out how to add an additional decimal to a value for a numerical token as well as a comma to indicate "thousands". For example, we have a token called {{lead.DBC Balance}} that pulls in how many "savings credits" a person has in their account. Most of our members show as having between "0" and "1000's" of credits; however, some show numbers such as 850.0 or 12500, etc., with only one decimal place after the period and none of them displaying a comma to indicate "thousands" of credits.
My question is whether I can use Velocity Script to 1. Add a 1/100's decimal place, e.g., instead of just showing 850.0 we would like to show 850.00 & 2. Be able to add a comma indicating thousands, e.g., instead of showing 12500, be able to show, 12,500 or 2,000, etc.
Thank you for your help in advance!
Laura Kimball
Solved! Go to Solution.
This is my first time using Velocity Script....Which VS editor do you recommend I use?
There's only one. (Within Marketo, I mean.)
When you add an Email Script token (a.k.a. Velocity token) this is your editor. Note the tree on the right-hand side, where you check off fields that you want use in the Velocity context.
Then you include the name of the Velocity token in your email, i.e. {{my.velocityToken}}.
${number.format(",${esc.h}${esc.h}0.00",$lead.DBCBalance)}
Make sure to check off your DBC Balance field in the right-hand tree of Script Editor. Also, I'm assuming the API/VTL name (which can't have spaces, so Marketo always converts it) is $lead.DBCBalance but you can drag the field into the Script Ed "canvas" to be sure.
Thank you Sanford!
This is my first time using Velocity Script....Which VS editor do you recommend I use?
Laura
This is my first time using Velocity Script....Which VS editor do you recommend I use?
There's only one. (Within Marketo, I mean.)
When you add an Email Script token (a.k.a. Velocity token) this is your editor. Note the tree on the right-hand side, where you check off fields that you want use in the Velocity context.
Then you include the name of the Velocity token in your email, i.e. {{my.velocityToken}}.
Okay, got it...I kind of figured that out once I opened the token editor .
If I want to change the date format for an expiration date token (see below) from appearing in an email as 2018-04-12 to April 12, 2018, how would I set up the Velocity Script?
{{lead.Expiration Date:default=edit me}}
Thank you!
Laura Kimball
Can you open a new thread for this new question and mark my answer above as Correct? Thanks.