List Includes
Checks if value is in the list
Description
Checks whether the value is in the list.
If From Index
is negative, it will be used as the offset from the end of collection.
The brick is supposed to be used to find the index in the list of primitive types (like strings, numbers, or booleans, CloudObject). <b>Date/time and color are complex objects and are not supported</b>
If you need to find the index in a collection of non-primitive types (e.g. objects) or the condition is more complex than just a value, it is recommended to use the Find In List
brick.
Examples:
-
inputs
- source =
[1, 2, 3]
- value =
1
- from index =
0
- source =
-
outputs
- result =
true
- result =
-
inputs
- source =
[1, 2, 3]
- value =
1
- from index =
2
- source =
-
outputs
- result =
false
- result =
Inputs
- Source (Object): The collection to inspect. Could be in the form of List, Array and QueryResult
- Value (Object): The value to search for
- From Index (Number): The index to search from
Outputs
- Result (Boolean):
True
ifvalue
is found, elsefalse
- Error Flow (Error Flow): Triggered by providing unexpected type of the source