I'm trying to add a word, as well as a comma but only if the next field isn't empty. If it is empty then I just want to add a word because it's the end of a list. My problem is if the field is empty, it won't show my word and Product1.

I'm sure I'm missing something simple but I can't figure it out. I had it as an Else but it kept showing the word and not the product1.

%%[ if not empty(@Product2) then ]%% 
  not empty 
%%= v(@Product1) =%%,
%%[ if empty(@Product2) then ]%% 
%%= v(@Product1) =%%%%[ENDIF]%%%%[ENDIF]%%

What am I missing?

  • 2
    Welcome to SFSE, please take some time to read How to Ask and take the tour. Once you have done so, could you please update your post title with a relevant title? thanks!
    – glls
    Feb 6, 2018 at 17:41

1 Answer 1


You should be able to do this in one line with an iif() (inline-if) statement:

%%=v(@Product1)=%%%%=iif(not empty(@product2), concat(", ", @product2), "")=%%

Of without the iif():


if not empty(@product2) then

  ouput(concat(", ", @product2))


  • Thank you for your help. Are there any examples on how to do the one line with iif()?
    – Angela1044
    Feb 6, 2018 at 20:01
  • I used an iif() in my example. Feb 6, 2018 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.