SOLVED

Convert a string to int with Velocity

Go to solution
Highlighted

Convert a string to int with Velocity

I need to convert a lead field, which holds a string to a integer with velocity scripting.

Does somebody has a solution for this?

I have tried the following, but I receive an error

#set( $tmp = 0 )
$tmp.parseInt( ${lead.PostalCode} )
${tmp}
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Convert a string to int with Velocity

#set( $anInteger = $convert.toInteger( $aString ) )‍‍

  • don't confuse "int" and "Integer", they're two different datatypes
  • use simple notation ($reference), not formal (${reference}) unless you're outputting

View solution in original post

2 REPLIES 2
Highlighted
Level 10 - Community Moderator

Re: Convert a string to int with Velocity

#set( $anInteger = $convert.toInteger( $aString ) )‍‍

  • don't confuse "int" and "Integer", they're two different datatypes
  • use simple notation ($reference), not formal (${reference}) unless you're outputting

View solution in original post

Highlighted
Level 10 - Community Moderator

Re: Convert a string to int with Velocity

Franky please return to the thread and mark my answer as Correct.