I have an ELSEIF AMPscript statement that looks like this:
<script runat=server language=ampscript>
var @code, @templateName
set @code = 'M200'
if @code == 'E001' then
set @templateName = 'Letter A'
elseif @code == 'M001'
or @code == 'M014'
or @code == 'M400' then
set @templateName = 'Letter B'
elseif @code == 'M002'
or @code == 'M500' then
set @templateName = 'Letter C'
elseif @code == 'M003'
or @code == 'M200' then
set @templateName = 'Letter D'
elseif @code == 'M004'
or @code == 'M005'
or @code == 'M006'
or @code == 'M007'
or @code == 'M008'
or @code == 'M009'
or @code == 'M010'
or @code == 'M011'
or @code == 'M012'
or @code == 'M013'
or @code == 'M600' then
set @templateName = 'Letter E'
elseif @code == 'M015' then
set @templateName = 'Letter F'
elseif @code == 'V100' then
set @templateName ='Letter G'
else
set @templateName = 'undefined'
endif
</script>
%%=v(@templateName)=%%
I would expect @templateName
to return 'Letter D' but it is returning 'Letter E'. Why do you think this is?
<script runat=server language=ampscript><script>
-- since it is processed differently than the traditional%%[ ]%%
. That's the way I understand it.%%[ ]%%
in my email, then it works. I thought the tag based syntax could be used interchangeably — I had no idea that they are evaluated differently!