Hi there,
Is there a way to use not in operator for the below conditional content
for example if language not in ("EN","FR","ES")
<% if (language == "EN" ) { %>
<DIV id=en-version>Hello <%= recipient.firstName %>,</DIV>
<DIV>Discover your new offers!</DIV>
<DIV><a href="https://www.adobe.com/products/en">www.adobe.com/products/en</A></FONT></DIV><%
} %>
<% if (language == "FR" ) { %>
<DIV id=fr-version>Bonjour <%= recipient.firstName %>,</DIV>
<DIV>Découvrez nos nouvelles offres !</DIV>
<DIV><a href="https://www.adobe.com/products/fr">www.adobe.com/products/fr</A></DIV><%
} %>
<% if (language == "ES" ) { %>
<DIV id=es-version><FONT face=Arial>
<DIV>Olà <%= recipient.firstName %>,</DIV>
<DIV>Descubra nuestros nuevas ofertas !</DIV>
<DIV><a href="https://www.adobe.com/products/es">www.adobe.com/products/es</A></DIV>
<% } %>
Please suggest
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @rvnth This will be the correct way
var features = '21,22,23,24,25,26,27,28,29,30,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51';
var featuresArray=features.split(',');
<% if ((featuresArray.indexOf(targetData.schema1.feat_cd) < 0) && (featuresArray.indexOf(targetData.schema2.feat_cd) < 0) && (featuresArray.indexOf(targetData.schema3.feat_cd) < 0) && !(featuresArray.indexOf(targetData.schema4.feat_cd) < 0)) { %>
Hello @rvnth
Yes, You can do it like this.
var languagues='ES,FR,EN';
var my_lang='JP'
if(languagues.split(',').indexOf(my_lang) < 0){ //
//print your content here
}
Thank you for your reply. If I do not want to use the my_lang variable, can I implement something like the following? I need to test this.
var features = '21,22,23,24,25,26,27,28,29,30,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51'
<% if (!(targetData.schema1.feat_cd in features) && !(targetData.schema1.feat_cd in features) && !(targetData.schema1.feat_cd in features) && !(targetData.schema1.feat_cd in features)) { %>
Views
Replies
Total Likes
Hello @rvnth This will be the correct way
var features = '21,22,23,24,25,26,27,28,29,30,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51';
var featuresArray=features.split(',');
<% if ((featuresArray.indexOf(targetData.schema1.feat_cd) < 0) && (featuresArray.indexOf(targetData.schema2.feat_cd) < 0) && (featuresArray.indexOf(targetData.schema3.feat_cd) < 0) && !(featuresArray.indexOf(targetData.schema4.feat_cd) < 0)) { %>
Hi @_Manoj_Kumar_ ,
The above code indexOf method === -1 worked for me.
Views
Replies
Total Likes
Hi @rvnth ,
You can try this way
<% if (language == "EN" ) { %>
<DIV id=en-version>Hello <%= recipient.firstName %>,</DIV>
<DIV>Discover your new offers!</DIV>
<DIV><a href="https://www.adobe.com/products/en">www.adobe.com/products/en</A></FONT></DIV><%
} %>
<% else if (language == "FR" ) { %>
<DIV id=fr-version>Bonjour <%= recipient.firstName %>,</DIV>
<DIV>Découvrez nos nouvelles offres !</DIV>
<DIV><a href="https://www.adobe.com/products/fr">www.adobe.com/products/fr</A></DIV><%
} %>
<% else if (language == "ES" ) { %>
<DIV id=es-version><FONT face=Arial>
<DIV>Olà <%= recipient.firstName %>,</DIV>
<DIV>Descubra nuestros nuevas ofertas !</DIV>
<DIV><a href="https://www.adobe.com/products/es">www.adobe.com/products/es</A></DIV>
<% } %>
<% else { %>
Your HTML Content
<% }%>
Regards,
Pravallika.
Views
Replies
Total Likes