Trying to append data to a Table file


I want to save data in a Table (using Table Writer) and then periodically append new data to it. The Table Writer node will either overwrite or fail if the table already exists (depending on configuration). My solution is to read in the table and then to concatenate new data and then save.

However, I have hit a snag. If the data table does not already exist, Table Reader fails with a Warning that the file does not exist. and the flow stops. I tried putting the Table Reader inside a Try-Catch, but that does not work becuse only a Warning is given if the file does not exist - it does not seem to fail badly enough to for the Try-Catch to deal with it. The flow simply stops at Table Reader.

Is there a way to check if a Table file exists before I use Table Reader to load it? Or is there some way to handle a Table file that does not exit.



Hi Paul,

you can use the List Files node to list the files in the source folder, filtering on the name of the file where your initial table should be. If the file with the table is not there, the node will return an empty table. You can then use the Empty Table Switch node to trigger an alternative flow with a default (empty) starting table.

Another way to do it is to extract the dimensions of the table out of List Files with Extract Table Dimension and, via a Java Edit Variable (simple) node, use it to control an IF node.

Depending on your use case, you may also take advantage of the Wait... node, which can wait for a specific file to be created in the file system.

Hope this helps.


Thanks Marco - that did the trick.

I had tried using the empty table switch, but it has data ports as outputs and the next node needs to be Empty Table Creator or Table Reader which have no data input port. However, I just put a dummy node after each IF selection and joined the dummy node to the Empty Table Creator or Table Reader  node using a Flow Variable connection.

Thanks for your help.