How to total up first few elements in a for each loop of Sightly? | AEM Community Blog Seeding | Community
Skip to main content
kautuk_sahni
Community Manager
Community Manager
May 27, 2020

How to total up first few elements in a for each loop of Sightly? | AEM Community Blog Seeding

  • May 27, 2020
  • 0 replies
  • 1502 views

BlogImage.jpg

How to total up first few elements in a for each loop of Sightly? by howtoaem Blog

Abstract

How to add the first three elements of a for loop in sightly and show the value as Total. I have code as below

{{each(i, provision) provisionTypes}}

{{/each}}
What I want to do is that in the each for loop, I want to display to the total of the first three elements... Not sure how to?

Best How To:
I don't think that is possible in Sightly. It is meant to be only for presentation purposes. it even lacks arithmetic operations, so you cannot really add numbers with it. You'll have to do it in the backend. You can use the WCMUse API (in it's java or javascript forms) to add some logic to your component

Read Full Blog

How to total up first few elements in a for each loop of Sightly?

Q&A

Please use this thread to ask the related questions.

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