HOW TO: Dynamically access and loop through nested arrays using handlebars

In this scenario, you have a subloop of a segment, such as NTE, where there are multiple values in the NTE loop. You'd like to structure this to dynamically build the JSON to include all of these values without hard-coding the specific loop number.

To handle this, you can nest {{#each}} statements and accomplish what you need through the following:

{{#each item}}
Loop through item array here
{{#each this.innerArray}}
Loop through innerArray here
{{this.prop}} (access inner array properties)
{{/each}}
>exit innerArray loop
{{/each}}
>exit item array loop

​​
This will allow you access and loop through each of the nested arrays.

This is just one of the many examples on how to combine different handlebar helpers in one expression. We have a great Handlebars library, including divide and ToFixed handlebarsI
You'll also probably want to check out our Inline handlebar helpers and Nested Expressions
Let us know if you have other handlebars questions we can help you with here on our community! Also, let us know if there's any information you'd like us to add to our handlebars documentation!