Expand my Community achievements bar.

SOLVED

Managing a condition from an element of a collection (Transacctional message)

Avatar

Level 2

Hi,
I have a request where I need to apply a different format when a condition is false.
This condition must affect to a line of a collection of articles (an article of a product list)
I have created a boolean element within a collection, however the boolean I have create is not available when I try to applicate a new condition to a field of the transacctional message.
Is there are way to use this kind of element (of a collection) as a event to be used as a condition?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @bravoga1977,

 

Try to create content block and reference the same in product listing to see if it works. It will look like something below,

 

<table>
<% for (var i =0; i < context.rtEvent.ctx.articleCollection.length; i++) { %>
<% if (context.rtEvent.ctx.articleCollection[i].articleAvailable == true) { %>
<tr>
<td>
<table>
<tbody>
<tr>
<td >
<%= context.rtEvent.ctx.articleCollection[i].articleName %>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<% } %>
<% } %>
</table>

Thanks, Sathees

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @bravoga1977,

 

Try to create content block and reference the same in product listing to see if it works. It will look like something below,

 

<table>
<% for (var i =0; i < context.rtEvent.ctx.articleCollection.length; i++) { %>
<% if (context.rtEvent.ctx.articleCollection[i].articleAvailable == true) { %>
<tr>
<td>
<table>
<tbody>
<tr>
<td >
<%= context.rtEvent.ctx.articleCollection[i].articleName %>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<% } %>
<% } %>
</table>

Thanks, Sathees

Avatar

Administrator

Hi @bravoga1977,

Was @SatheeskannaK's solution helpful to resolve your query? In case it was helpful, then kindly choose it as the 'Correct Reply'. If not and you still need more help, then do let us know.

Thanks!



Sukrity Wadhwa

Avatar

Level 2

Hi @Sukrity_Wadhwa,

 

Well, it was not the solution I was looking for but guided me a bit on the path to follow.

Thanks!

Avatar

Administrator

Glad to know it helped you a bit.  

Could you please share the solution with the rest of the Community as well so that it helps them too in case they are facing the same issue? 

Thanks!



Sukrity Wadhwa