> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-cloud/studio/tasks/reference/length/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # length > Use the length task to return the number of elements in a given array. The `length` task returns the number of elements in a given array. The return value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. By unsigned, the value represents only non-negative integers. ## Potential use case Every failed login attempt on your device stores the username and timestamp in an array. Your company's password attempt policy stipulates a maximum of three failed attempts within a specific timeframe. The `length` (array) task will provide the number of login attempts for subsequent workflow processing. ## Properties | Incoming | Type | Description | | -------- | ---------------- | ------------------------------- | | `arr` | Array (required) | The array to get the length of. | | Outgoing | Type | Description | | -------- | ------ | ------------------------------------------------------------------------- | | `length` | Number | Expressed as a numerical value, this is the number of items in the array. | ## Examples In the example shown below: * The **Reference task** and **Reference variable** set for the `length` (array) task is `job` and `arr`, respectively. As an option, you can toggle the **Run Window** slider to set the task to run on a schedule. ![](/_fern-img/a56ab3a30c3936d1990ae584cf07436f1c4007ef87f2cb6aa7cddf8b16541d69.webp) * The array variables are set prior to running the workflow. ![](/_fern-img/5a05591377151e3d5fe1e7ffcacfe9e12aa955b219c976b58b9a7c7b16c3050c.webp) * Once you run the workflow, the incoming variables that were set are displayed under the **Incoming** tab in **Task History**, which is accessed from Jobs (Operations Manager). ![](/_fern-img/d412fdd2eed0c46da4a3de723b7cb425a25b03825c37ef8ba2f4e08577c524e0.webp) * This output example returns the length of the array. ![](/_fern-img/00df8208f6ffdbfbc2effbe2dcbd0df771ff3da702834f4ef50bd404644b04c7.webp) > Use the length task to return the number of elements in a given array.