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; }