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

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

  • May 23, 2022
  • 1 reply
  • 913 views

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.
Best answer by Shashi_Mulugu

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

1 reply

Shashi_Mulugu
Community Advisor
Shashi_MuluguCommunity AdvisorAccepted solution
Community Advisor
May 23, 2022

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

Keerthi97Author
Level 3
May 24, 2022

Hi @shashi_mulugu ,

Thanks for your response .

 

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

 

Thanks.