Nested Hashtag Loops for Iterating over Bucket Keys
This page demonstrates nesting of Hashtag Loops for Buckets.
Hashtag Buckets are a collection of Hashtag Variables prefixed with the same key.
Bucket names are treated case insensitively by the Hashtag Framework.
Processing this Hashtag Markup:
<#
set response.0.order_info.orderid to "1234";
set response.0.order_info.total to "20";
set response.0.items.0.product_name to "order #0 item #0 name";
set response.0.items.0.total to "10";
set response.0.items.1.product_name to "order #0 item #1 name";
set response.0.items.1.total to "10";
set response.1.order_info.orderid to "1235";
set response.1.order_info.total to "10";
set response.1.items.0.product_name to "order #1 item #0 name";
set response.1.items.0.total to "10";
#>
<# start loop for response; #>
<hr>
order #<# key #> - orderid: <# value.order_info.orderid as html #><br>
<## start loop for <# value.items #>; save key to item_key; save value to item_value; #>
item #<# item_key as html #>: <# item_value.product_name as html #><br>
item total: <# item_value.total as html #><br>
<## end loop #>
order total: <# value.order_info.total as html #><br>
<# end loop #>
order #0 - orderid: 1234
item #0: order #0 item #0 name
item total: 10
item #1: order #0 item #1 name
item total: 10
order total: 20
order #1 - orderid: 1235
item #0: order #1 item #0 name
item total: 10
order total: 10