If/Else statement help - error | Community
Skip to main content
Level 2
June 21, 2024
Solved

If/Else statement help - error

  • June 21, 2024
  • 1 reply
  • 715 views

Hello,

I am configuring a simple if else statement to display content based on data being passed in targetdata in the workflow.  Here is my statement.  I have tested the "if" part alone and it works fine but once I add in the Else, I get the following error.


<% if ( targetData.segment == "A" ) { %>

HELLO

<% } %>

 


<% else { %>

GOODBYE

<% } %>

 

 

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 DavidKangni

Hi,

 

try this 

 

<% if ( targetData.segment == "A" ) { %>

HELLO
<% } else { %>

GOODBYE

<% } %>

 

Thanks,

David

1 reply

DavidKangni
Community Advisor
DavidKangniCommunity AdvisorAccepted solution
Community Advisor
June 21, 2024

Hi,

 

try this 

 

<% if ( targetData.segment == "A" ) { %>

HELLO
<% } else { %>

GOODBYE

<% } %>

 

Thanks,

David

David Kangni
Level 2
June 21, 2024

Thank you David.  That worked!  It seems on V8, the function is not correct.  I took it directly from Adobe here-

<% else { %>

Insert content here

<% } %>