Generate Dynamic script with banner dimensions in an array from Sling model/HTL | Community
Skip to main content
Level 3
May 23, 2022 1:55 PM UTC
Solved

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

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Shashi_Mulugu
Shashi_MuluguAccepted solution
New Participant
May 23, 2022 2:45 PM UTC

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

2 replies

Shashi_Mulugu
Shashi_MuluguAccepted solution
New Participant
May 23, 2022 2:45 PM UTC

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

Translate
Keerthi97Author
Level 3
May 24, 2022 7:34 AM UTC

Hi @shashi_mulugu ,

Thanks for your response .

 

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

 

Thanks.

 

Translate