Skip to main content
Franky_Ruyssch2
Level 4
September 9, 2019
已解决

Convert a string to int with Velocity

  • September 9, 2019
  • 2回复
  • 7913查看

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}
此主题已关闭回复。
最佳答案由 SanfordWhiteman
#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

2回复

SanfordWhiteman
Level 10
September 9, 2019
#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
SanfordWhiteman
Level 10
September 11, 2019

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