Re: Velocity Script logic - help needed

Kacper_Gawlik1
Level 2

Velocity Script logic - help needed

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

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Script logic - help needed

Pls read my last few answers to Velocity questions first, as another user had a nearly identical situation within the past couple of weeks.

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Script logic - help needed

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity Script logic - help needed

... also, while this isn't directly connected to the Velocity (just the implicit lines that do the output) this seems like a pretty cumbersome way to manage the ICS side. Great place for an Agical link instead, which can be assembled dynamically within Velocity so everything stays connected.