I know the subject line might not make too much sense so hopefully my description will make sense. I have the below code in my Ampscript

IF @ModelCode == 'AC' THEN SET @ModelName = 'A1234' ENDIF
IF @ModelCode == 'CR' THEN SET @ModelName = 'C1234' ENDIF
IF @ModelCode == 'HR' THEN SET @ModelName = 'H5467' ENDIF
IF @ModelCode == 'OD' THEN SET @ModelName = 'O9876' ENDIF
IF @ModelCode == 'CI' THEN SET @ModelName = 'C5234' ENDIF

IF @Model == 'HR' THEN SET @Subject = 'All-new HR'
ELSEIF @Model == 'CI' THEN SET @Subject = 'All-new CI'
ELSE SET @Subject = 'Original %%=v(@Modelname)=%%'

The first part of the @subject IF statement is working correctly but the (@Modelname) that is contained within the ELSE SET for @Subject is not pulling in the model name and instead is just showing the subject of 'Original %%=v(@Modelname)=%%'

eg. If the @modelcode selected in my data is 'AC' the @subject should be showing 'Original A1234'

Is there a workaround to ensure the set value for @modelname is pulled in?

Thank you advance.

  • Shouldn't IF @Model == 'HR' THEN be IF @ModelCode == 'HR'? Apr 14, 2022 at 12:09

1 Answer 1


If you want to set a string as a combination of text and ampscript variable, you should use the concat function:

ELSE SET @Subject = Concat('Original ',@Modelname)
  • Thanks that worked flawlessly. Cheers
    – Kane Elias
    Apr 14, 2022 at 6:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .