Expand my Community achievements bar.

SOLVED

Generate Dynamic script with banner dimensions in an array from Sling model/HTL

Avatar

Level 4

Hi All,

 

We have a requirement to append the banner dimensions in an array format to generate the script encoded in HTL .Here in the script , the size mapping should be formed from the input given in the multi field item.

 

sizeMapping: [

[[x, y], [[a, b], [e, f]]],

[[z ,x], [a, b]],

[[y, z], [[e, f], [c, d]]],

],

sizes: [

[a, b],

[e, f],

[c, d],

],

[x, y],[z ,x],[y, z]-Breakpoint (first multi field values)

[a, b], [e, f],[c, d]-BannerSizeDimensions(nested multi field values)

So , size mapping should be formed in the combination of single breakpoint(highlighted) and multiple banner size dimensions as above in the array format .Also ,sizes should be formed from the unique values present in the banner size dimensions input as above.Could you please help me on how to achieve this array formatting in the script through sling model/HTL.

 

Thanks in Advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Keerthi97 Welcome to communities, Are you not using Sling models to support your component. It should be fairly simple to achieve/code all your business logic in sling model and use HTL to support your UI or html or script generation.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@Keerthi97 Welcome to communities, Are you not using Sling models to support your component. It should be fairly simple to achieve/code all your business logic in sling model and use HTL to support your UI or html or script generation.

Avatar

Level 4

Hi @Shashi_Mulugu ,

Thanks for your response .

 

Can you please share any code reference to achieve the above array formatting from sling model .

 

Thanks.