Velocity Email Script - Greater Than or Less Than Operators | Community
Skip to main content
October 26, 2017
Solved

Velocity Email Script - Greater Than or Less Than Operators

  • October 26, 2017
  • 1 reply
  • 2350 views

I want to serve content based on whether or not the Score field is greater than an certain number.  I've been able to do equals, doesn't equals, and contains, but cannot figure out greater than (or less than)

This is what I thought should work but hasn't:

#set ($ScoreCount = ${lead.scoreCount})

#if($ScoreCount > 10)

Content A

#else

Content B

#end

Any thoughts on if this is possible?

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

What you have is fine if the variable is really an Integer. I suspect it's coming in as a String, so convert it:

#set($ScoreCount = $convert.toNumber($lead.scoreCount) )

#if($ScoreCount > 10)

Content A

#else

Content B

#end

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
October 26, 2017

What you have is fine if the variable is really an Integer. I suspect it's coming in as a String, so convert it:

#set($ScoreCount = $convert.toNumber($lead.scoreCount) )

#if($ScoreCount > 10)

Content A

#else

Content B

#end

October 26, 2017

that worked perfectly! You're the best!