Tuesday, April 30, 2013

Pre-populate Talend custom component schema

I run into an issue today where the tFileInputCSVFilter custom component was outputting empty lines instead of real records. The issue was related to using READONLY="true" in PARAMETER FIELD="SCHEMA_TYPE". Setting it to true or just removing it to fall into the default value did the trick. Leaving it to true will make the schema non editable. Going the extra mile I set the TABLE node inside the filter and reject schemas to make sure the "line" (which represents a whole line from the input) was available automatically. For example for the filter (I did the same for main and reject even though main is configured as having no outputs):
...
     <PARAMETER NAME="SCHEMA_FILTER" FIELD="SCHEMA_TYPE" NUM_ROW="1" CONTEXT="FILTER">
       <TABLE READONLY="false">
         <COLUMN NAME="line" TYPE="id_String" READONLY="false"/>
       </TABLE>
     </PARAMETER>
...
Do not forget to set the component schema to auto propagate using COMPONENT SCHEMA_AUTO_PROPAGATE ="true".

Bottom line I have found that the schema must be editable so in Talend custom components in order for them to be pre-populate or even available to following components. Failure to do so will result in empty lines as the schema will be missing and so there would be no place to flush the output.

No comments:

Followers