Hi Natalie.
Will this work for you? I believe that I got all 32 combinations (The #else parameter is blank which would result when all variable = N). Just replace my Y's and N's of the #set commands with your fields in the header of the code. I've made them bold:
#set($a="
Y")
#set($b="
N")
#set($c="
Y")
#set($d="
Y")
#set($e="
N")
#if ($a=='Y' && $b=='Y' && $c=='Y' && $d=='Y' && $e=='Y')|GF||V||K||Org||GMOFree|
#elseif ($a=='Y' && $b=='N' && $c=='Y' && $d=='N' && $e=='Y')|GF||K||GMOFree|
#elseif ($a=='Y' && $b=='N' && $c=='Y' && $d=='Y' && $e=='Y')|GF||K||Org||GMOFree|
#elseif ($a=='Y' && $b=='Y' && $c=='N' && $d=='Y' && $e=='Y')|GF||V||Org||GMOFree|
#elseif ($a=='Y' && $b=='Y' && $c=='Y' && $d=='N' && $e=='Y')|GF||V||K||GMOFree|
#elseif ($a=='Y' && $b=='Y' && $c=='Y' && $d=='Y' && $e=='N')|GF||V||K||Org|
#elseif ($a=='Y' && $b=='Y' && $c=='Y' && $d=='N' && $e=='N')|GF||V||K|
#elseif ($a=='Y' && $b=='Y' && $c=='N' && $d=='Y' && $e=='N')|GF||V||Org|
#elseif ($a=='Y' && $b=='Y' && $c=='N' && $d=='N' && $e=='Y')|GF||V||GMOFree|
#elseif ($a=='Y' && $b=='Y' && $c=='N' && $d=='N' && $e=='N')|GF||V|
#elseif ($a=='Y' && $b=='N' && $c=='Y' && $d=='Y' && $e=='N')|GF||K||Org|
#elseif ($a=='Y' && $b=='N' && $c=='Y' && $d=='N' && $e=='N')|GF||K|
#elseif ($a=='Y' && $b=='N' && $c=='N' && $d=='Y' && $e=='Y')|GF||Org||GMOFree|
#elseif ($a=='Y' && $b=='N' && $c=='N' && $d=='Y' && $e=='N')|GF||Org|
#elseif ($a=='Y' && $b=='N' && $c=='N' && $d=='N' && $e=='Y')|GF||GMOFree|
#elseif ($a=='Y' && $b=='N' && $c=='N' && $d=='N' && $e=='N')|GF|
#elseif ($a=='N' && $b=='Y' && $c=='Y' && $d=='Y' && $e=='Y')|V||K||Org||GMOFree|
#elseif ($a=='N' && $b=='Y' && $c=='Y' && $d=='N' && $e=='Y')|V||K||GMOFree|
#elseif ($a=='N' && $b=='Y' && $c=='Y' && $d=='Y' && $e=='N')|V||K||Org|
#elseif ($a=='N' && $b=='Y' && $c=='Y' && $d=='N' && $e=='N')|V||K|
#elseif ($a=='N' && $b=='Y' && $c=='N' && $d=='Y' && $e=='Y')|V||Org||GMOFree|
#elseif ($a=='N' && $b=='Y' && $c=='N' && $d=='Y' && $e=='N')|V||Org|
#elseif ($a=='N' && $b=='Y' && $c=='N' && $d=='N' && $e=='Y')|V||GMOFree|
#elseif ($a=='N' && $b=='Y' && $c=='N' && $d=='N' && $e=='N')|V|
#elseif ($a=='N' && $b=='N' && $c=='Y' && $d=='Y' && $e=='Y')|K||Org||GMOFree|
#elseif ($a=='N' && $b=='N' && $c=='Y' && $d=='N' && $e=='Y')|K||GMOFree|
#elseif ($a=='N' && $b=='N' && $c=='Y' && $d=='Y' && $e=='N')|K||Org|
#elseif ($a=='N' && $b=='N' && $c=='Y' && $d=='N' && $e=='N')|K|
#elseif ($a=='N' && $b=='N' && $c=='N' && $d=='Y' && $e=='Y')|Org||GMOFree|
#elseif ($a=='N' && $b=='N' && $c=='N' && $d=='Y' && $e=='N')|Org|
#elseif ($a=='N' && $b=='N' && $c=='N' && $d=='N' && $e=='Y')|GMOFree|
#else
#end
------------------------------
Jonathan Varo | PIM Lead
Fender Musical Instruments | 480-845-5823
------------------------------
Original Message:
Sent: 08-06-2020 09:50
From: Natalie Scott
Subject: VTl Multiple Attributes, one output field
I have a syndication template I am working on where I want multiple attributes to display in one column if they are true. I am not sure of the logic that would avoid each new attribute creating its own line which on the CVS export causes a new data line instead of continuing on the same row. I know the #end is what is causing the issue, I am just not sure of how to write multiple if statements where each value can be true.
Doing my best to get better at VTL.
Thanks-Natalie
VTL
#if(${P_Item.Gluten Free.code}=='Y')|GF|
#end
#if(${P_Item.Vegan.code}=='Yes')|V|
#end
#if(${P_Item.Kosher.code}=='Yes')|K|
#end
#if(${P_Item.Labeled Certified Organic.code}=='Yes')|Org|
#end
#if(${P_Item.Certified GMO Free.description}=='Yes')|GMOFree|
#end
Output in VTL Preview
|GF||V||K||Org|
CVS incorrect output
47301,,,Wisconsin,"|GF|
|GMOFree|",,Cooler,
------------------------------
Natalie Scott | Data Governance & Business Process Manager
Gourmet Foods International | 404-210-4367
------------------------------