Using the TO/BY operators - Cloud - 8.0

Talend Data Shaping Language Reference Guide

Version
Cloud
8.0
Language
English
Product
Talend Cloud
Module
Data Shaping Language
Content
Design and Development
Last publication date
2023-11-23

The TO and BY operators can be used to create an expression that returns an array of integers.

The expression should be structured as follows:
first_value TO last_value BY increment
Note: In Talend Data Mapper, the BY clause is optional. If it is absent, the default increment is 1 if the second value is greater than the first value, and -1 if the first value is greater than the second value. For example, the query SELECT 1 TO 5 returns [1, 2, 3, 4, 5].
The values specified can be an integer or any identifier or expression that can be interpreted as an integer. For example:
FROM in
LET $first = 5
SELECT $first TO ($first * 5) BY 2
With the query above, the following result is returned:
[[5,7,9,11,13,15,17,19,21,23,25]]