Delete element from array
The "Delete element from array" robot removes elements from an array of values by value or by position in Bitrix24 (Alaio) business processes and robots. In value mode all matches are removed (case-insensitive by default), in index mode a single element is removed, negative indexes count from the end. It returns the array after deletion, the number of elements deleted, and the resulting count.
The robot cuts elements out of an array and returns a new list — unlike the "Remove value from a multiple-value field" robot, it works on the passed array, not on a CRM entity field. The input is a multiple-value field or another robot output, the deletion mode, and the target: in value mode every element equal to the given value is removed (the Case-sensitive flag controls the comparison), in index mode one element is removed by position, 0 being the first and -1 the last. An empty target in value mode removes the empty elements of the array. Typical use cases: exclude a specific e-mail from a mailing list; drop the first element after processing it; clean empty values out of an array before a loop. It returns the array after deletion, the number of elements deleted, and the resulting count — use them in the next steps of the business process.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Array of values | string | yes | |
| Mode: value — by value, index — by position (default value) | string | — | |
| What to delete: a value or an index (0 = first, -1 = last) | string | — | |
| Case-sensitive comparison (Y/N, default N) | string | — |
What does the robot return?
| Parameter | Type |
|---|---|
| Array after deletion | string |
| Elements deleted | int |
| Resulting element count | int |
Scenario: excluding an address from a mailing
- The process has collected an array of recipient e-mails
- The robot deletes the opted-out client address from the array
- The mailing loop runs over the array after deletion — the opted-out client gets no letter