AnsweredAssumed Answered

Velocity Script logic - help needed

Question asked by Kacper Gawlik on Mar 28, 2019
Latest reply on Mar 28, 2019 by Sanford Whiteman

Hi All,

 

I would appreciate your help with improving our logic to the following scenario.

We have a custom field to which we store values of every session that someone registered to:.

i.e. Markeot field:Event 1 - Feb-SGT | Mar-EST | Apr-SGT etc.

 

Now based on that, we'd like to present particular event details with link to .ics file etc.

 

Our current logic is rather rough, as we are prediciting every possible combinations in a custom field (which looks as per below), where as each #if and each #elseif contains event details with links and calendar files.

 

#set ($field1 = "${lead.webinar1}")


#if ($field1.contains("| Feb-SGT | Mar-EST | Apr-SGT"))
#elseif ($field1.contains("| Feb-EST | Mar-SGT | Apr-SGT"))
#elseif ($field1.contains("| Feb-SGT | Mar-SGT | Apr-SGT"))
#elseif ($field1.contains("| Feb-SGT | Mar-SGT | Apr-EST"))  
#elseif ($field1.contains("| Feb-SGT | Mar-EST | Apr-EST"))           
#elseif ($field1.contains("| Feb-EST | Mar-SGT | Apr-EST"))
#elseif ($field1.contains("| Feb-EST | Mar-EST | Apr-SGT"))             
#elseif ($field1.contains("| Feb-EST | Mar-EST | Apr-EST")
#elseif ($field1.contains("Mar-EST | Apr-SGT"))                     
#elseif ($field1.contains("Mar-SGT | Apr-EST"))               
#elseif ($field1.contains("Mar-SGT | Apr-SGT"))
#elseif ($field1.contains("Mar-EST | Apr-EST"))               
#elseif ($field1.contains("| Feb-SGT | Apr-EST"))
#elseif ($field1.contains("| Feb-EST | Apr-SGT"))
#elseif ($field1.contains("| Feb-SGT | Apr-SGT"))  
#elseif ($field1.contains("| Feb-EST | Apr-EST"))
#elseif ($field1.contains("| Feb-SGT | Mar-EST"))
#elseif ($field1.contains("| Feb-SGT | Mar-SGT"))
#elseif ($field1.contains("| Feb-SGT | Mar-EST"))
#elseif ($field1.contains("| Apr-SGT"))
#elseif ($field1.contains("| Feb-SGT"))


#else
##Do nothing
#end

 

Can you give any centric approach to deal with this? As this above is madness.

 

Appreciate your help!

 

Thanks,

Kacper

Outcomes