---
title: "trim · RUAL Documentation"
description: "trim a list to the specified range"
canonical: https://docs.rual.nl/block-types/redis/redis_list_trim
language: en
---

# trim

This block is part of the [`redis`](https://docs.rual.nl/block-types/redis) group and was last modified in core [`v13.0.7`](https://docs.rual.nl/core-versions/130007).

### Redis Key Selection Required

This block relies on a Redis key to perform its redis releated actions. You must manually select the Redis key you want to use in the flow in the blueprint using the Redis key selector modal. To access the modal, click the white button on the block.

trim a list to the specified range

- flow `flow`

- start required `number` the index to start at.

- stop required `number` the index to stop at. can be -1 or -2

- flow `flow`

- result `value`

- success `condition`

- error `value`

- key `v13.0.7` `value`

| `redis ltrim` |
| --- |
| `ltrim` |

A typical wiring for [trim](https://docs.rual.nl/block-types/redis/redis_list_trim): [number](https://docs.rual.nl/block-types/number/number_default) feeds the `start` pin; [push](https://docs.rual.nl/block-types/redis/redis_list_push) feeds the `flow` pin; [push array](https://docs.rual.nl/block-types/redis/redis_list_push_array) feeds the `list` pin; [number](https://docs.rual.nl/block-types/number/number_default) feeds the `stop` pin; the `flow` out pin feeds [reply in JSON](https://docs.rual.nl/block-types/json/httpconnection_set_json); the `result` out pin feeds [range](https://docs.rual.nl/block-types/redis/redis_list_range).

![Studio canvas example for the trim block: typical wiring for trim.](https://docs.rual.nl/canvas-examples/redis_list_trim.png)

### Commonly used with

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

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

- [reply in JSON](https://docs.rual.nl/block-types/json/httpconnection_set_json): this block feeds into it. Reply to any httpconnection as JSON body.

- [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.

- [push](https://docs.rual.nl/block-types/redis/redis_list_push): feeds into this block. prepend one element to a list.

- [push array](https://docs.rual.nl/block-types/redis/redis_list_push_array): feeds into this block. prepend multiple elements to a list.

- [range](https://docs.rual.nl/block-types/redis/redis_list_range): this block feeds into it. get a range of elements from a list. Use start 0 and stop -1 to retrieve all items.

### Version history

Introduced in [`v13.0.7`](https://docs.rual.nl/core-versions/130007).

### Service documentation
