Using Dollar sign $ in front of token {{lead.DOLALR AMOUNT}} breaks the token | Community
Skip to main content
Lucas_Metherall
New Participant
May 1, 2020
Solved

Using Dollar sign $ in front of token {{lead.DOLALR AMOUNT}} breaks the token

  • May 1, 2020
  • 1 reply
  • 6525 views

hi all,

 

We are sending a summary email of donation amounts for the FY. We have custom currency field Total Amount of Gifts, and, because it is a currency field, it only takes numbers, not characters (i.e. $).

 

HOWEVER, trying to reference that token in the email, I write Total Gifts Received: ${{Total Amount of Gifts}}, and the token breaks in the live email. I just see a single }.

Anyone got any insight on this?

 

Thanks!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

I hoped you'd jump on this. Questions for you;
  • Why does ${{ break the token code?

Because the character sequence ${ is reserved: it's the start of a Velocity Template Language reference.

 

So the parser doesn't see an intact {{lead.token}} block, which is the Marketo token reference.

 

In the WYSIWYG do I simply type ${esc.d}{{lead.Gift Amount}} ? What command is {esc.d}?


${esc.d} is a Velocity escape sequence for a dollar sign. So we're adding a complete VTL sequence to be parsed (from ${ to closing }) and then the {{lead.token}} stands alone. In other words, the parsers don't trip over each other.


how bad is the currency data field? What are common problems with it? Is it Apple Maps bad?

Bad enough. It's a 16-bit float, so there aren't enough bits to represent common amounts without approximation — commonly called "rounding" but that's putting too rosy a face on it, FP rounding isn't like "nearest 100" because it's binary. And more approximation is enforced at the MySQL level. I wrote a blog about it a couple of years ago, you can search for it. Also lots of reading materials out there on floats.

1 reply

SanfordWhiteman
New Participant
May 1, 2020

Use

 

${esc.d}{{lead.token name}}

 

P.S. You should never, ever use Currency. It's a broken datatype and you'll lose data. 

Lucas_Metherall
New Participant
May 1, 2020

Hi Sanford,

 

I hoped you'd jump on this. Questions for you;

  • Why does ${{ break the token code?
  • In the WYSIWYG do I simply type ${esc.d}{{lead.Gift Amount}} ? What command is {esc.d}?
  • how bad is the currency data field? What are common problems with it? Is it Apple Maps bad?

 

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 1, 2020

I hoped you'd jump on this. Questions for you;
  • Why does ${{ break the token code?

Because the character sequence ${ is reserved: it's the start of a Velocity Template Language reference.

 

So the parser doesn't see an intact {{lead.token}} block, which is the Marketo token reference.

 

In the WYSIWYG do I simply type ${esc.d}{{lead.Gift Amount}} ? What command is {esc.d}?


${esc.d} is a Velocity escape sequence for a dollar sign. So we're adding a complete VTL sequence to be parsed (from ${ to closing }) and then the {{lead.token}} stands alone. In other words, the parsers don't trip over each other.


how bad is the currency data field? What are common problems with it? Is it Apple Maps bad?

Bad enough. It's a 16-bit float, so there aren't enough bits to represent common amounts without approximation — commonly called "rounding" but that's putting too rosy a face on it, FP rounding isn't like "nearest 100" because it's binary. And more approximation is enforced at the MySQL level. I wrote a blog about it a couple of years ago, you can search for it. Also lots of reading materials out there on floats.