Syntax
WHERE(array, path, [value])
Usage examples
Example 1
Input | 1 { 2 "staff": [ 3 { 4 "name": "Alice", 5 "department": "engineering" 6 }, 7 { 8 "name": "Bob", 9 "department": "sales" 10 }, 11 { 12 "name": "Charlie", 13 "department": "engineering" 14 } 15 ] 16 } |
Formula | WHERE(staff, "department", "engineering") |
Output | 1 [ 2 { 3 "name": "Alice", 4 "department": "engineering" 5 }, 6 { 7 "name": "Charlie", 8 "department": "engineering" 9 } 10 ] |
Example 2
Input | 1 { 2 "staff": [ 3 { 4 "name": "Alice", 5 "department": { 6 "name": "engineering", 7 "role": "manager" 8 } 9 }, 10 { 11 "name": "Bob", 12 "department": { 13 "name": "sales", 14 "role": "assistant" 15 } 16 }, 17 { 18 "name": "Charlie", 19 "department": { 20 "name": "sales", 21 "role": "manager" 22 } 23 } 24 ] 25 } |
Formula | WHERE(staff, "department.role", "manager") |
Output | 1 [ 2 { 3 "name": "Alice", 4 "department": { 5 "name": "engineering", 6 "role": "manager" 7 } 8 }, 9 { 10 "name": "Charlie", 11 "department": { 12 "name": "sales", 13 "role": "manager" 14 } 15 } 16 ] |
Example 3
If 'value' isn't provided, return all objects where the path exists and the value at that path IS_PRESENT.
Input | 1 { 2 "staff": [ 3 { 4 "name": "Alice", 5 "department": { 6 "name": "engineering", 7 "role": "manager", 8 "team": "AI" 9 } 10 }, 11 { 12 "name": "Bob", 13 "department": { 14 "name": "sales", 15 "role": "assistant", 16 "team": " " 17 } 18 }, 19 { 20 "name": "Charlie" 21 }, 22 { 23 "name": "Denise", 24 "department": { 25 "name": "sales", 26 "role": "manager" 27 } 28 } 29 ] 30 } |
Formula | WHERE(data.staff, "department.team") |
Output | 1 [ 2 { 3 "name": "Alice", 4 "department": { 5 "name": "engineering", 6 "role": "manager", 7 "team": "AI" 8 } 9 } 10 ] |
Sample Actions
Select an action to inspect
You can also click "Copy actions" and paste them in your Tines story to see how they work.