The <%...%> syntax - Cloud - 8.0

Talend Studio User Guide

Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Talend Studio
Design and Development
Last publication date

This syntax can span lines. The following list points out what you can do with this syntax and what you should pay attention to.

  • You can define new variables, use Java logical code like if, for and while, and also get parameter values.

    For example, if you want to get the FILE_Name parameter, use the code as follows:

String filename = __FILE_NAME__;
  • This syntax cannot be used within an SQL statement. In other words, it should be used between two separated SQL statements.

    For example, the syntax in the following code is valid.

#sql sentence
DROP TABLE temp_0;
for(int i=1; i<10; i++){
#sql sentence
DROP TABLE temp_<%=i %>;
#sql sentence
DROP TABLE temp_10;

In this example, the syntax is used between two separated SQL templates: DROP TABLE temp_0; and DROP TABLE temp_<%=i%>;.

The SQL statements are intended to remove several tables beginning from temp_0. The code between <% and %> generate a sequence of number in loop to identify tables to be removed and close the loop after the number generation.

  • Within this syntax, the <%=...%> or </.../> syntax should not be used.

<%=...%> and </.../> are also syntax intended for the SQL templates. The below sections describe related information.


Parameters that the SQL templates can access with this syntax are simple. They are often used for connection purpose and can be easily defined in components, such as TABLE_NAME, DB_VERSION, SCHEMA_TYPE, etc.