The isarray function in APL checks whether a specified value is an array. Use this function to validate input data, handle dynamic schemas, or filter for records where a field is explicitly an array. It’s particularly useful when working with data that contains fields with mixed data types or optional nested arrays.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.

In Splunk SPL, similar functionality is achieved by analyzing the data structure manually, as SPL doesn’t have a direct equivalent to isarray. APL simplifies this task by providing the isarray function to directly evaluate whether a value is an array.

```sql Splunk example | eval is_array=if(isnotnull(mvcount(field)), "true", "false") ```
['dataset.name']
| extend is_array=isarray(field)

In ANSI SQL, there is no built-in function for directly checking if a value is an array. You might need to rely on JSON functions or structural parsing. APL provides the isarray function as a more straightforward solution.

```sql SQL example SELECT CASE WHEN JSON_TYPE(field) = 'ARRAY' THEN TRUE ELSE FALSE END AS is_array FROM dataset_name; ```
['dataset.name']
| extend is_array=isarray(field)

Usage

Syntax

isarray(value)

Parameters

Parameter Description
value The value to check if it’s an array.

Returns

A boolean value:

  • true if the specified value is an array.
  • false otherwise.

Use case example

Filter for records where the events field contains an array.

Query

['otel-demo-traces']
| take 50
| summarize events_array = make_list(events)
| extend is_array = isarray(events_array)

Run in Playground

Output

is_array
true

Good morning

I'm here to help you with the docs.

I
AIBased on your context