Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

can we write multiplication logic in sightly

Avatar

Avatar
Boost 1
Level 1
vijithavari
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
vijithavari
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
vijithavari
Level 1

27-05-2021

can we write multiplication logic in sightly

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

470 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

470 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

27-05-2021

 HTL is purely a templating language and you cannot do any logic manipulation in it. You have to either use Java or JS for the same.

 

If you don't have an associated Java class and this is the only action you want to do with some properties , I will give you a quick tip. In cases like that I always use a Javascript Use-API. For such small things I would prefer JS rather than going a Java route. Refer below link to see how you can write. If you don't get an idea, let me know I will try to provide some sample 

 

https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/use-api-javascript.html?lan... 

 

PS:- This is just a personal tip 🙂 

 

 

 

Thanks

Veena ✌

Answers (2)

Answers (2)

Avatar

Avatar
Boost 100
Employee
markus_bulla_adobe
Employee

Likes

104 likes

Total Posts

86 posts

Correct Reply

44 solutions
Top badges earned
Boost 100
Applaud 25
Affirm 25
Boost 50
Boost 25
View profile

Avatar
Boost 100
Employee
markus_bulla_adobe
Employee

Likes

104 likes

Total Posts

86 posts

Correct Reply

44 solutions
Top badges earned
Boost 100
Applaud 25
Affirm 25
Boost 50
Boost 25
View profile
markus_bulla_adobe
Employee

27-05-2021

Hi @vijithavari!

 

AFAIK calculations are not supported in HTL (formerly known as Sightly) and I don't find it in the specification [1].

In general I would recommend to move any business logic - including any necessary calculations - to an according Sling Model. This allows better exception handling and easier testing.

 

Hope that helps.

 

[1] https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

27-05-2021