Access value inside nested array using handlebars

Comments

3 comments

  • Kelly Izer Senior Solutions Consultant
    Awesome Follow-up
    Engaged
    Answer Pro
    Top Contributor
    Celigo University Level 4: Legendary

    Aishwarya,

         I just tested this in the sandbox and was able to get it to successfully evaluate the following expression

    {{#each productData}}
    {{#each salsify:digital_assets}}
    {{#compare salsify:id "===" ../[Main Product Image]}}{{salsify:url}}{{else}}{{/compare}}
    {{/each}}
    {{/each}}

    Please give that a try and let us know if you are still having issues.

     

    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Aishwarya M J you just have to make sure to wrap fields in brackets, [], if there are spaces in the field name.

    {{#each productData}}{{#each this.[salsify:digital_assets]}}{{#compare this.[salsify:id] "===" ../[Main Product Image]}}{{this.[salsify:url]}}{{else}}{{/compare}}{{/each}}{{/each}}

    0
  • Aishwarya M J Referral Partner
    Engaged
    Celigo University Level 4: Legendary

    Hi Kelly Izer Tyler Lamparter

    Thank you so much for the help. My issue is resolved now.

    0

Please sign in to leave a comment.