Expand my Community achievements bar.

@ format in sightly working differently in AEM 6.1 and AEM 6.3

Avatar

Level 3

Hi,

We have a component where for creating multiple tabs on the page which has code snippet as below.

<div data-sly-resource="${tab.token @ format=[itemList.index], resourceType='foundation/components/parsys'}"></div>

The "tab.token" will be a value that we give in the component dialog as tab name, for example, tab1 and tab2. The above code appends an index 0,1 and so on for each node created in AEM 6.3 but doesn't add the index in AEM 6.1.

This issue is reproducible in AEM 6.3 SP1 CFP1.

Thanks,

Prem

8 Replies

Avatar

Level 10

First - for syntax issues with HTL - check with the HTL Spec here -- htl-spec/SPECIFICATION.md at master · Adobe-Marketing-Cloud/htl-spec · GitHub

Are you trying to build a multi-tab component in the web page with HTL?

Avatar

Level 10

Two questions:

1. What you want expected output to be.

2. You are seeing in issue in 6.3 or 6.1 ( I am not clear on last statement "The above code appends an index 0,1 and so on for each node created in AEM 6.3 but doesn't add the index in AEM 6.1.")

Avatar

Level 3

Yes the above code doesn't add index values to node in 6.3 but nor in 6.1

Avatar

Level 10

What output are you trying to do. Typically, a collection when working with HTL is built in a WCMUse POJO or Sling Model Java class and then displayed in HTL.

Avatar

Level 3

We are using the above line of code to add an index dynamically to the names for tabs, for example, written_by0, written_by1, and written_by2 in order to avoid duplication of the same node and so on. This did not work in our 6.1 environments so we just had dialog validation restricting authors to avoid duplication but then we did not remove this code to append "@ format= {itemList.index}" for the node name.

But when compared to 6.3 we are not able to fetch content from the node written-by because the above code is looking for the content under written_by0. While debugging we found that the same code which did not add index value to node name in AEM 6.1 is adding index now in 6.3. Is this bug with AEM 6.1 or 6.3 and after referring to sightly documents @format will replace "formatting pattern string " but in the line of code that the copied doesn't contain any formatting pattern string like below

<div data-sly-resource="${tab.token{0} @ format=[itemList.index]}

Avatar

Level 3

When I cheked with one of my collegue who is also using AEM 6.3 CFP2 he doesn't see index value added at the end of node name. My instance is AEM 6.3 SP1 CFP1.

Avatar

Level 10

" Is this bug with AEM 6.1 or 6.3 and after referring to sightly documents @format will replace "formatting pattern string " but in the line of code that the copied doesn't contain any formatting pattern string like below"

Please open a support ticket as this does look like a bug as its not behaving as documented.

Avatar

Level 1

<sly data-sly-test.parResource="${'par{0}' @format=[itemList.index]}"></sly>

This is working fine in AEM 6.3 SP1-CFP2

Thanks.

Abhishek