Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am writing a custom component and want to use some input data. I use tFileInputDelimited and connect it with tMap to my component.
I now want to read every line of input and log it to the console. (Later I want to convert it and use it within my component, that is why tLogRow is not the right solution).
How can I do that?
I tried
IMetadataTable preMetadata = null;
if ((node.getIncomingConnections()!=null)&&(node.getIncomingConnections().size()>0))
preMetadata = node.getIncomingConnections().get(0).getMetadataTable();
String inRowName = node.getIncomingConnections().get(0).getName();
List<IMetadataColumn> columns = preMetadata.getListColumns();%>
for (int i = 0; i < columns.size(); i++){
IMetadataColumn column = columns.get(i);%>
System.out.println(String.valueOf(<%=inRowName%>.<%=column.getLabel() %>));
<%
}
but it keeps printing 'null'..
When I run the same job but with tLogRow at the end (tFileInputDelimited - tMap - tLogRow), it logs every value on the console so I assume there is now problem with loading the file.
Thanks for your help!
Hello,
There is a component tfileinputfullrow in talend which can read a file row by row and send complete rows of data as defined in the schema to the next component via a Row link.
Have you tried to use this input component before your custom component to see if it works?
Best regards
Sabrina
Hi,
thanks for you reply.
I tried tFileInputFullRow. But then the column only has one element. When I want to print it, it still prints 'null'.
When I use tLogRow it works fine.
Do you have any idea what my component does wrong?
Hi,
What does your custom component look like? Have you already shared your custom component on talend exchange portal?
Best regards
Sabrina
Hi,
I have not published the component as it doesn't work for the moment. In attachment you can find the .xml and begin files.
Hi,
Somehow now it works. I had a look at the tFileOutputPDF component and changed some lines. I don't know what the mistake was but ich works
But I still have a question:
If I put all the code to the begin.javajet file again I just get 'null'.
Why do I have to read for input in the main file?