SOLVED

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

Go to solution
Highlighted

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

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!

 

Broken code in Editor.PNGLive email broken.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

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


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.

View solution in original post

4 REPLIES 4
Highlighted
Level 10 - Community Moderator

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

Use

 

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

 

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

Highlighted

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

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?

 

Highlighted
Level 10 - Community Moderator

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


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.

View solution in original post

Highlighted

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

Very helpful, thank you again.