ETL: custom header and footer

I’m using knime for some custom ETL and I’m in need to placing a custom header and footer, simple strings, into the resulting output file.

I tried a java snippet to create the file with header, csv writer to append, then another java snippet to open the file and append the footer. It pretends to work, but file isn’t getting the header or footer, and I believe those java snippets run for each row which will slow things down a lot. I think this is related to the string I’m using for the file is in uri format and java isn’t liking that. I can fix that, but I ponder if there is another way to do this.

Any suggestions?

General info: In case you want to run a Java Snippet independently from a table’s rows, you can use the Java Edit Variable node:

Just connect the flow variables with to the node after which the snippet should be executed. It will only run once, not for each table row. For your use case it would make sense to check the “Run only on execution” option (else wise the code will already execute when closing the dialog).

Beside that, I’d assume that you code causes some exceptions and thus does not get executed properly. Have a look at the “Console” tab to see some logging which should state if/where an error occurred.

HTH,
Philipp

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.