limit limit

Returns the first or last N elements of a list.

Category

List

Function syntax

limit(<parameters>)

Parameters

Parameter
Type
Description
listToProcess
listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly, or listObject
List to consider. For listObject, it must be a field reference.
numberOfItems
integer
Number of items to be returned from the given list.
firstOrLastItems
boolean
This parameter is optional (true by default). true returns the first items. false returns the last items.

Signature and returned type

limit(<listString>,<integer>)
limit(<listString>,<integer>,<boolean>)

Returns a list of strings.

limit(<listInteger>,<integer>)
limit(<listInteger>,<integer>,<boolean>)

Returns a list of integers.

limit(<listDecimal>,<integer>)
limit(<listDecimal>,<integer>,<boolean>)

Returns a list of decimals.

limit(<listBoolean>,<integer>)
limit(<listBoolean>,<integer>,<boolean>)

Returns a list of booleans.

limit(<listDateOnly>,<integer>)
limit(<listDateOnly>,<integer>,<boolean>)

Returns a list of dates.

limit(<listDateTimeOnly>,<integer>)
limit(<listDateTimeOnly>,<integer>,<boolean>)

Returns a list of datetimes without considering time zone.

limit(<listDateTime>,integer>)
limit(<listDateTime>,<integer>,<boolean>)

Returns a list of datetimes.

limit(<listDuration>,<integer>)
limit(<listDuration>,<integer>,<boolean>)

Returns a list of durations.

limit(<listObject>,<integer>)
limit(<listObject>,<integer>,<boolean>)

Returns a list of objects.

Example

limit(["A", "B", "C", "D", "E"], 3)

Returns ["A","B","C"].

limit(["A", "B", "C", "D", "E"], 3, false)

Returns ["C","D","E"].

recommendation-more-help
b22c9c5d-9208-48f4-b874-1cefb8df4d76