Code to access the component schema elements - 7.3

Talend Open Studio User Guide

Version
7.3
Language
English
Product
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Module
Talend Studio
Content
Design and Development
Last publication date
2023-10-11
Available in...

Open Studio for Big Data

Open Studio for Data Integration

Open Studio for ESB

Component schema elements are presented on a schema column name list (delimited by a dot "."). These elements are created and defined in components by users.

The below code composes an example to access some elements included in a component schema. In the following example, the ELT_METADATA_SHEMA variable name is used to get the component schema.

<%
String query = "select ";
SCHEMA(__ELT_METADATA_SHEMA__);
for (int i=0; i < __ELT_METADATA_SHEMA__.length ; i++) {
query += (__ELT_METADATA_SHEMA__[i].name + ",");
}
query += " from " + __TABLE_NAME__;
%>
<%=query %>;

In this example, and according to what you want to do, the __ELT_METADATA_SHEMA__[i].name code can be replaced by __ELT_METADATA_SHEMA__[i].dbType, __ELT_METADATA_SHEMA__ [i].isKey, __ELT_METADATA_SHEMA__[i].length or __ELT_METADATA_SHEMA__[i].nullable to access the other fields of the schema column.

The extract statement is SCHEMA(__ELT_METADATA_SHEMA__);. In this statement, ELT_METADATA_SHEMA is the variable name representing the schema parameter to be extracted. The variable name used in the code is just an example. You can change it to another variable name to represent the schema parameter you already defined.

Warning:

Make sure that the name you give to the schema parameter does not conflict with any name of other parameters.

For more information on component schema, see Basic Settings tab.