Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Can we use % (modulo) in Sightly

Avatar

Level 3

Can we use %(modulo) in Sightly

I want to use below condition in sightly, how can I use it

<ul data-sly-list="${properties.size}">

<li  data-sly-test="${itemList.count % 3 ==0}"> Test </li>

</ul>

I know above code don't work. How to achieve above condition in sightly.

1 Accepted Solution

Avatar

Correct answer by
Administrator

HTL (formerly known as Sightly ) only supports logical and comparison operators. It is intended as the view rendering scripts are not supposed to contain business logic, this should come from the model/use-objects/Js use-api.

Spec:- htl-spec/SPECIFICATION.md at master · Adobe-Marketing-Cloud/htl-spec · GitHub

Js Use-API: HTL JavaScript Use-API

Feike Visser Please correct me if I am wrong here.

~kautuk



Kautuk Sahni

View solution in original post

7 Replies

Avatar

Correct answer by
Administrator

HTL (formerly known as Sightly ) only supports logical and comparison operators. It is intended as the view rendering scripts are not supposed to contain business logic, this should come from the model/use-objects/Js use-api.

Spec:- htl-spec/SPECIFICATION.md at master · Adobe-Marketing-Cloud/htl-spec · GitHub

Js Use-API: HTL JavaScript Use-API

Feike Visser Please correct me if I am wrong here.

~kautuk



Kautuk Sahni

Avatar

Employee

No %-modulo can't be used. However it is a great improvement to HTL/Sightly.

Would you mind to raise a sling-ticket on this?

Avatar

Level 3

Thanks kautuksahni & Feike Visser

​Will raise sling ticket for the same.

Avatar

Employee

Let me know the ticket, so I can help to expedite it.

Avatar

Level 1

Would be great to have this functionality. If i need to render a list, and do something specific for every 5th element, ${itemList.index % 5 == 0} would be very useful.

Avatar

Employee

Raise a sling jira-ticket for it.