> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/2023-2/studio/tasks/reference/slice-array/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # slice (array) > Reference for the slice (array) workflow task, which extracts a section of an array and returns it as a new array without modifying the original. The `slice (array)` task extracts a section of an array and returns a new array containing a portion of the original. The source array is not modified. ## Potential use case Suppose you have a large incoming array whose elements are arrays themselves, and you only need specific values from exact positions. Instead of using `pop (array)` and altering the length of the original array, use `slice (array)` to obtain a smaller subset for immediate processing. This provides faster processing in `for` loops. ## Properties | Incoming | Type | Description | | -------- | ------ | ----------------------------------------------------------------------------------------------------------------- | | `arr` | Array | Required. The array to slice. | | `begin` | Number | Required. The index at which to start extraction. Arrays are zero-indexed. Defaults to `0` if omitted. | | `end` | Number | Required. The index at which to end extraction. If omitted, the entire array from `begin` to the end is selected. | | Outgoing | Type | Description | | ------------- | ----- | ---------------------------------------------- | | `slicedArray` | Array | A new array containing the extracted elements. | ## Configure the task The array variables and the `begin` and `end` indexes are set before running the workflow. In the example below, `begin` is `1` and `end` is `4` — that is, `slice(1,4)` extracts from the second element through the third element (the element at index 4 is not included). ![]()![]() A negative index can be used to select from the end of an array. For example, `slice(2,-1)` extracts from the third element through the second-to-last element. The element at the `end` index is not included in the result. After the workflow executes, the incoming variables — including the `begin` and `end` indexes — are displayed under the **Incoming** tab in Task History, accessible from Jobs in Operations Manager: ![]() The **Outgoing** tab displays the `slicedArray` result. Based on the input parameters, the new array `["b","c","d"]` contains a portion of the original source array: ![]() > Reference for the slice (array) workflow task, which extracts a section of an array and returns it as a new array without modifying the original.