How to use operator "OR" in a conditional statement | Community
Skip to main content
alik98709228
Level 2
January 11, 2018
Solved

How to use operator "OR" in a conditional statement

  • January 11, 2018
  • 2 replies
  • 3394 views

Hi,

I am using following conditional statements to display 4 different images based on 4 different values (1, 2, 3, or 4) in TREATMENT_ID column. The following conditional statement is working, however i want to edit it to use "OR" since the image is the same for the values 1 and 2:

<% if (targetData.TREATMENT_ID == '1'){%>

<img class="setImageFull" src="http://img/image1.png" width="600" height="82" alt="Rewards Certificate"/>

<% } else if (targetData.TREATMENT_ID == '2'){%>

<img class="setImageFull" src="http://img/image1.png" width="600" height="82" alt="Rewards Certificate"/>

<% } else if (targetData.TREATMENT_ID == '3'){%>

<img class="setImageFull" src="http://img/image3.png" width="600" height="82" alt="Rewards Certificate"/>

<% } else if (targetData.TREATMENT_ID == '4'){%>

<img class="setImageFull" src="http://img/image4.png" width="600" height="82" alt="Rewards Certificate"/>

<%}%>

Here is the edited code. Does this would work:

<% if (targetData.TREATMENT_ID == '1') Or (targetData.TREATMENT_ID == '2')  {%>

<img class="setImageFull" src="http://img/image1.png" width="600" height="82" alt="Rewards Certificate"/>

Thanks!

AK

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by saikatk2447661

Use || instead of Or.

2 replies

saikatk2447661
saikatk2447661Accepted solution
Level 4
January 11, 2018

Use || instead of Or.

david--garcia
Level 10
January 12, 2018

Adobe Campaign Help | Advanced expression editing

<% if (targetData.TREATMENT_ID == '1' || targetData.TREATMENT_ID == '2') {%>