Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Sightly AEM -size or length of array in siglty

Avatar

Community Advisor

I want get the length or size of my list in aem sightly,so is there any property like size to get the total count of elements in the list?

1 Accepted Solution

Avatar

Correct answer by
Employee

you can use the methods that you have in Java for the concerned object.

Like

${ myArray.length}

${ myList.size }

View solution in original post

3 Replies

Avatar

Level 7

Modifying my comments:-

Very well said by Feike , i tried by creating a small sample in my local and able to get size of list.

${<useClassObject>.<ListMethodName>.size}

For Example:-

In java:-

public List getTestList() {

return testList;

}

In HTML:-

<sly data-sly-use.useClassObj = "com.ups.components.use.ArrayListClassUse">

Size of List:- ${useClassObj .testList.size}

</sly>

Hope it helps. Thanks Feike for quick response.

Avatar

Correct answer by
Employee

you can use the methods that you have in Java for the concerned object.

Like

${ myArray.length}

${ myList.size }

Avatar

Community Advisor

Yes Prince. , Please try the way Feike has mentioned here.