Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Farraylength.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Farraylength.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `arrayLength`

## Description

Returns the number of elements in an array.

## Syntax

Like many functions in DataPrime, `arrayLength` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
arrayLength(array: array<any>): number
```

```
(array: array<any>).arrayLength(): number
```

## Arguments

| Name    | Type         | Required | Description                               |
| ------- | ------------ | -------- | ----------------------------------------- |
| `array` | `array<any>` | **true** | The array whose length will be calculated |

## Example

**Use case: Determine the number of jobs waiting to be processed**

Suppose you have a list of jobs in a queue. Consider the following input:

```
{

    "loading_jobs_waiting": ["loading_job1", "loading_job2", "loading_job3"]

}
```

By applying `arrayLength`, you can find out how many jobs are waiting.

### Example query

* Function notation
* Method notation

```
create waiting_jobs from arrayLength(loading_jobs_waiting)
```

```
create waiting_jobs from loading_jobs_waiting.arrayLength()
```

### Example output

The result will include the count of array elements:

```
{

    "loading_jobs_waiting": ["loading_job1", "loading_job2", "loading_job3"],

    "waiting_jobs": 3

}
```
