inArray
- Checks if the item’s value is present/absent in an array.
- This feature is available since the version. This method might be used for all types, which can be compared for equality.
The scene is triggered when the condition of the specified operation is satisfied.
- operation checks if the item’s value is present in the array.
- operation checks if the item’s value is absent in the array.
Edit
Field | Type | Required | Description |
---|---|---|---|
blockOptions.method.args.item blockOptions.method.args.expression |
item expression | + | Id of an item or expression whose value to check. |
blockOptions.method.args.value | array | + | An array of values to search in. Should contain at least 2 elements. |
blockOptions.method.args.operation | string | – | The operation that determines which check will be performed. Possible values: , . Default is . |
Edit
Internal error code | Message | Data |
---|---|---|
SCENE_WRONG_WHEN_BLOCK | inArray: empty id of an item | ezlo.scenes.block.when.wrong |
SCENE_WRONG_WHEN_BLOCK | inArray: “value” field is empty | ezlo.scenes.block.when.wrong |
SCENE_WRONG_WHEN_BLOCK | inArray: cannot create valid value: [REASON] | ezlo.scenes.block.when.wrong |
SCENE_WRONG_WHEN_BLOCK | inArray: value should be an array, actual type: [TYPE] | ezlo.scenes.block.when.wrong |
SCENE_WRONG_WHEN_BLOCK | inArray: unknown operation: [OPERATION] | ezlo.scenes.block.when.wrong |
SCENE_WRONG_WHEN_BLOCK | inArray: array should have at least 2 values, for comparing against a single value use “isItemState” method | ezlo.scenes.block.when.wrong |
Edit
{
"blockType": "when",
"blockOptions": {
"method": {
"name": "inArray",
"args": {
"item": "item",
"operation": "operation",
"value": "value"
}
}
},
"fields": [
{
"name": "item",
"type": "item",
"value": "5de64f6a70c7be0541cc0853"
},
{
"name": "operation",
"type": "string",
"value": "not_in"
},
{
"name": "value",
"type": "array.string",
"value": [ "a", "b", "c" ]
}
]
}