Highlighted

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

Avatar

Avatar

premchandr61956

Avatar

premchandr61956

premchandr61956

11-01-2018

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

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

11-01-2018

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?

Highlighted

Avatar

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392

Avatar

edubey

Total Posts

1.5K

Likes

264

Correct Answer

392
edubey

11-01-2018

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.")

Highlighted

Avatar

Avatar

premchandr61956

Avatar

premchandr61956

premchandr61956

11-01-2018

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

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

11-01-2018

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.

Highlighted

Avatar

Avatar

premchandr61956

Avatar

premchandr61956

premchandr61956

11-01-2018

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]}

Highlighted

Avatar

Avatar

premchandr61956

Avatar

premchandr61956

premchandr61956

11-01-2018

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.

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

11-01-2018

" 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.

Highlighted

Avatar

Avatar

abhisheks422283

Avatar

abhisheks422283

abhisheks422283

08-02-2018

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

This is working fine in AEM 6.3 SP1-CFP2

Thanks.

Abhishek