Velocity email script split data based on delimiter "|"
In CO table, one of the field has product value in below format
product = productname | productimage | productcode
My pain point is to split the data but I am getting below issue
Cannot get email content- <div>An error occurred when procesing the email Body! </div> <p>Encountered "]" near</p> <div><pre ><p><span style="font-family: Verdana;">#set( $productArr = ["1","2","3"] )</pre><pre >#if( !$display.alt($CO_c["product"],"").isEmpty())</pre><pre class="x-form-item-label">#set( $productArr[] = $CO_c["product"].split("|") )</pre><pre >$productArr[1]</pre><pre >$productArr[2]</pre></div>
I have tried below sample VTL code.
##Using split("|") function to seprate the data sets
#set( $productArr = ["1","2","3"] )
#if( !$display.alt($CO_c["product"],"").isEmpty())
#set( $productArr[] = $CO_c["product"].split("|") )
$productArr[1]
$productArr[2]
$productArr[3]