Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Smart object

iHub provides a fast feature to access array items called smart objects, any customfield of type List or JSON response of type array will have these smart functions. 

For child applications that have "Auto-generate 1st level as variables from parent response" checked will automatically get an object called array for JSON that begins with an array. example [ {"name":"Peter"},{{"name":"Rickard"}}] then this will be accessable as {{array}}. 

Expressioncomment
{{array.first}}Gets the first object
{{array.first}}Gets the last object
{{array.index_n}}Gets the index object, n as number
{{array}}Get all the items, then use normal Mustache Iteration .example: {"body":"{{#array}}{{name}}{{/array}}"}
{{array.sumInteger}}If an array is of type integer, example [1,2,3,4] then iHub can sum that to be 10
{{array.sumDouble}}If an array is of type double, example [1.7, 2.0, 3.0, 4.0] then iHub can sum that to be 10.7

Mustache

Iterate over an array

example variable result of variable users: [ A, B , C ]

Body:

{{#users}}
"{{.}}"
{{/users}}

Result:

A,B,C,


Iterate over an array with Users and get email

example variable result of variable users: [ rick(rick), mr.bot(mr.bot) , cc (cc) ]

Body:

{{#users}}
"{{emailAddress}}"
{{/users}}

Result:

rick@rixter.se,mr.bot@rixter.se,cc@rixter.se,


Removing trailing comma in array

example variable result of variable users: [ A, B , C ]

Body:

{{#users}}
"{{.}}"
{{/users}}

{{^users}}
"{{.}}"
{{/users}}

Result:

A,B,C


  • No labels