Using the LET clause - Cloud

Talend Data Shaping Language Reference Guide

English (United States)
Talend Cloud
Data Shaping Language
Design and Development
The LET clause is used to define a variable that can be reused later in the query.
The LET clause should be structured as follows:
LET $variable_name = expression

The variable must start with the $ character and cannot be a hierarchical identifier, for example, $item.index is not a valid variable. The variable must be unique throughout the query. The expression used to specify the value of the variable can be a simple expression or a conditional expression.

The LET clause must be used after a FROM, UNNEST or JOIN clause. If the query block contains a WHERE clause, the LET should be placed before it. For example:
FROM customer
LET $address = concatWith(" ", address.street,
WHERE hasValue(rating) && rating > 650
SELECT { name, rating, address = $address }

The LET clause is evaluated for each iteration in the query, unlike the WITH clause.