foreachobject

Executes some code for every json object in given json array

Syntax

foreachobject("json")
foreachobject("json","selector")

Function arguments

  • json – (String) string containing valid json object or array of json objects
  • selector – (String) [Optional] JSONPath selector that will be used to select array or object from json on which loop will be executed

Return value

This function does not return a value.

Examples

Example 1:
Executes code for every row from table returned from ExecuteSQL. Table is returned as json containg array of json objects. Inside code current json object is accesible as this variable.

foreachobject(ExecuteSQL("dsn","select * from table","json"){
  a=this.prop1;
 b=this.prop2; 
}

Example 2:
Executes code for every object in projects table from json string stored in json field.

foreachobject([json],"projects"){
  a=this.name; 
}
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.