Help with Velocity Script - multi-value field to array and printing split values to a table
Hello community. I am new to velocity scripting and working on printing split values from a multi-value field into a table. I have a few different approaches to the script but have been unable to get the results we are seeking. Would appreciate any help from the community.
My multi-field value (Event_Sessions__c) is storing session preferences from a form field as
10am session1; 11am session2; 12PM Session3;
This is my first iteration of the script but I keep getting errors:
#if( $lead.Event_Sessions__c.isEmpty() )
#set( $lead.Event_Sessions__c = '[]' )
#end
#set( $EventSessions = $lead.Event_Sessions__c )
#set( $SplitEvents = $EventSessions.split(";") )
<table>
<tbody>
<tr>
<td>$SplitEvents[0]</td>
</tr>
<tr>
<td>$SplitEvents[1]</td>
</tr>
<tr>
<td>$SplitEvents[2]</td>
</tr>
<tr>
<td>$SplitEvents[3]</td>
</tr>
<tr>
<td>$SplitEvents[4]</td>
</tr>
<tr>
<td>$SplitEvents[5]</td>
</tr>
<tr>
<td>$SplitEvents[6]</td>
</tr>
</tbody>
</table>
any tips would be appreciated.