Skip to main content
Close announcements banner

Using the TO/BY operators

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
Information noteNote: 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]]

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 – let us know how we can improve!