Skip to main content
  • New archived content: Talend MDM, Talend Data Catalog 8.0, and Talend 7.3 products reached their end of life in 2024. Their documentation was moved to the Talend Archive page and will no longer receive content updates.
Close announcements banner

Using array predicates

An array predicate allows you to filter items by their position in the current context.

This predicate is used after a location step, in square brackets, to return one or more items based on their index. The table below describes the syntax to use.
Syntax Description Examples
[index] Returns the item with the specified index.
  • .customer[0] returns the first item in the customer array.
  • .customer[-1] returns the last item in the customer array.
[index:] Returns items whose index is equal to or greater than the specified index.
  • .customer[-3:] returns the last three items in the customer array.
  • .customer[2:] returns all items in the customer array starting from the third one.
[:index] Returns items whose index is equal to or lesser than the specified index.
Information noteNote: When used with a negative number, this syntax subtracts the specified value from the size of the array and compares the result to the indexes in the array. For example, for an array with 5 items, [:-2] returns all items whose index is lesser than or equal to 5-2, so it returns indexes 0 to 3 and only ignores the last item, which has the index 4.
  • .customer[:5] returns the first six items in the customer array.
  • .customer[:-2] returns all items in the customer array except for the last one.
[start_index:end_index] Returns items between the first index and the second index. Both the start index and the end indexes are included in the result.
  • .customer[2:5] returns the third, fourth, fifth and sixth items in the customer array.
  • .customer[-3:-2] returns the third and second items from the end of the customer array.
[*] Returns all items in the current context. .customer[*] returns all items in the customer array.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!