Skip to main content

Limite

Limits the number of elements transmitted to the next block. Keeps the first N elements of an array.

Parameters

ParameterTypeRequiredVariableDescription
inputArraydynamic valueNoYesInput array to limit. Can reference a previous block output.
limitdynamic valueYesYesMaximum number of items to keep. (min 1)
offsetdynamic valueNoYesNumber of items to skip from the start (default: 0).
fromEndbooleanNoNoTake items from the end instead of the start. (Default: false)
outputVariabletextNoNoOutput variable name containing the limited array.

Parameters marked Variable = Yes accept the {{blockName.field}} syntax.

Output

Output variable : limitedData

{
"results": [],
"count": 0
}

Example

Keep only the first 5 results.

Input :

{"items": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}

Output :

{"results": [1, 2, 3, 4, 5], "count": 5}
Tip

{{limitedData.results}} contains the truncated array. Combine with a Sort block to keep the top N results.