Code to access the component schema elements - 6.5

Talend Data Fabric Studio User Guide

EnrichVersion
6.5
EnrichProdName
Talend Data Fabric
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

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.