This is my first post and I'm a newbie when it comes to anything code-related let alone AMPscript so any and all help would be very much appreciated. Thank you in advance!
I'm using AMPscript in the footer of my emails and depending on a contact's subscription preferences, I'd like to dynamically show the groups they're subscribed to. The code seems to be working fine, however, I've noticed that if a person is subscribed to multiple consent groups, I am unable to add any formatting such as commas between the two groups. Rather, the line of text that appears says
%%EmailAddress%% is subscribed to X Y Z
%%EmailAddress%% is subscribed to X, Y, and Z
Does anyone know how I can add the commas in between multiple variables? My code is below.
%%[ Var @econsent, @fconsent, @tconsent, @email, @editorial, @first, @third Set @email=EmailAddress Set @econsent=AttributeValue("Consent_EditorialContentEmails") Set @fconsent=AttributeValue("Consent_FirstPartyEmails") Set @tconsent=AttributeValue("Consent_ThirdPartyEmails") Set @editorial='X' Set @first='Y' Set @third='Z' ]%% %%Emailaddr%%</a> is subscribed to receive emails from %%[if @econsent == true THEN]%% X %%[ENDIF]%% %%[if @fconsent == true THEN]%% Y %%[ENDIF]%% %%[if @tconsent == true THEN]%% Z %%[ENDIF]%%