hasAny

Check if at least one of the values is defined or true in order to execute the block code.

1
2
3
{{#hasAny [value1] [value2]...}}
...
{{/hasAny}}
Example
format JSON XML
Data JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"ProductOne": {
"name": "Chocolate",
"size": "small",
"quantity":"8",
"price": "1.00"
},
"ProductTwo": {
"name": "Candy",
"size": "small",
"quantity":"8"
}
}
Code
1
2
3
4
5
6
7
{{#hasAny ProductOne.description ProductOne.price}}
Yes we are selling chocolates!
{{/hasAny}}
{{#hasAny ProductTwo.description ProductTwo.price}}
Yes we are selling candies!
{{/hasAny}}
Result
Data XML
1
2
3
4
5
6
7
8
9
10
11
<data>
<ProductOne
name="Chocolate"
size="small"
quantity="8"
price="1.00" />
<ProductTwo
name="Candy"
size="small"
quantity="8" />
</data>
HTML
1
2
3
4
5
6
7
{{#hasAny data.ProductOne._.description data.ProductOne._.price}}
Yes we are selling chocolates!
{{/hasAny}}
{{#hasAny data.ProductTwo._.description data.ProductTwo._.price}}
Yes we are selling candies!
{{/hasAny}}
Result