0

I'm trying to build a dynamic email with different blocks displaying based on the if/else check. I can't understand how do I display nothing and go to the next step if the condition is not met. Here is the code:

var @condition
Set @condition= AttributeValue("Value")
set @content = ContentBlockById("123456")
  
IF IndexOf(@condition, "value1")>0 OR IndexOf(@condition, "value2")>0 THEN
set @block1 = @content

ELSE 
set @block1 = **here I need to display nothing**

ENDIF

]%%
%%=v(@block1)=%%

Is there any specific string for it?

Thanks!

1 Answer 1

1

You can simply remove the else statement like this:

%%[

var @condition, @block1 
Set @condition= AttributeValue("Value")
set @content = ContentBlockById("123456")
  
IF IndexOf(@condition, "value1")>0 OR IndexOf(@condition, "value2")>0 THEN
   set @block1 = @content
ENDIF

]%%
%%=v(@block1)=%%

If no value is populated to @block1 variable, it will be empty.

2
  • It worked and was easier than I thought :) Thanks a lot!
    – Mikhail
    Feb 22 at 14:11
  • If you find it helpful, kindly mark it as the accepted answer. Thanks
    – Duc Le
    Feb 22 at 14:23

You must log in to answer this question.

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