0

Data extension field: Subscription_Status

I want to write an inline ampscript in email, to say, if 'Sub_Item' is CH+, display "XYZ" and have multiple of these i.e., if 'Sub_Item' is D+, display "ABC" and so on.

Can someone please help me out?

2 Answers 2

0

So base on the image that you provided, I think your ampscript should look like this

%%[

VAR @Sub_Item, @output
SET @Sub_Item = AttributeValue("Sub_Item")

IF @Sub_Item == "CH+" THEN
  SET @output = "XYZ"
ELSEIF @Sub_Item == "D+" THEN
  SET @output = "ABC"
ELSE
  SET @output = "anything here"
ENDIF

]%%

<p>%%=v(@output)=%%</p>

References: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/attributevalue.htm

https://ampscript.guide/attributevalue/

4
  • Hi Obet, this doesn't seem to work for me, can you recommend some alternative? May 20, 2020 at 1:34
  • I've added an image to my question if that helps.. May 20, 2020 at 1:37
  • I edited my answer. Hope it helps.
    – Obet
    May 21, 2020 at 3:54
  • Oh my God Obet, thank you so so much! It worked!! May 21, 2020 at 7:20
0

I'd strongly recommend the AMPScript Guide (https://ampscript.guide/introduction/) as an excellent documentation source for getting started with AMPScript.

If statements are covered here: https://ampscript.guide/statements/

Assuming the Subscription_Status field is in the DE you're sending to, you can get the value with AttributeValue: https://ampscript.guide/attributevalue/

You must log in to answer this question.

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