---
title: "add to top of array · RUAL Documentation"
description: "Adds your given value to your given array."
canonical: https://docs.rual.nl/block-types/array/array_unshift
language: en
---

# add to top of array

This block is part of the [`array`](https://docs.rual.nl/block-types/array) group and was last modified in core [`v10.4.28`](https://docs.rual.nl/core-versions/100428).

### Type Selection Required

This block requires you to select the data type you want to work with. You must manually select the type using the type selector modal. To access the modal, click the white button on the block.

### Field Selection Required

This block requires field selection (in). You must manually select the fields you want to work with using the field selector modal. To access the modal, click the white button on the block.

Adds your given value to your given array.

- array `array` The array you want to put your new value on top of (optional).

- Array `array` The array with the added value at the top.

Inserts at the FRONT of a copy of the input array; the input is never mutated. Every filled one of the object, value, number, condition and date pins is inserted, keeping that fixed order at the head. A date is inserted as a unix-seconds number. With no array wired the output is a new array holding just the inserted value(s).

| `unshift` |
| --- |

A typical wiring for [add to top of array](https://docs.rual.nl/block-types/array/array_unshift): [get guid](https://docs.rual.nl/block-types/users/user_get_guid) feeds the `value` pin; [select field values](https://docs.rual.nl/block-types/array/array_get_values_from_bp_field) feeds the `array` pin; the `array` out pin feeds [remove duplicates](https://docs.rual.nl/block-types/array/array_remove_duplicates).

![Studio canvas example for the add to top of array block: typical wiring for add to top of array.](https://docs.rual.nl/canvas-examples/array_unshift.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [get fields](https://docs.rual.nl/block-types/object/object_field_getter_multiple): feeds into this block. Gets the selected fields from the given object.

- [execute](https://docs.rual.nl/block-types/function%20execution/function_custom_execute): wired in both directions with this block. Executes the given funcion and waits for it to be executed.

- [get guid](https://docs.rual.nl/block-types/users/user_get_guid): feeds into this block. Returns the guid (field: _meta.guid) of the given user.

- [remove duplicates](https://docs.rual.nl/block-types/array/array_remove_duplicates): this block feeds into it. Removes duplicate values from an array.

- [concat](https://docs.rual.nl/block-types/array/array_concat): this block feeds into it. Returns a joined array of two or more arrays.

- [select field values](https://docs.rual.nl/block-types/array/array_get_values_from_bp_field): feeds into this block. returns an array with values of the given field in this array of objects.

### Version history

Introduced in [`v10.4.28`](https://docs.rual.nl/core-versions/100428).
