File Reader Node not resetting in Loop

I am using KNIME 3.7.2. I have a strange problem with file reader node where I am passing a list of files (URLs) via a ‘table row to variable loop’. I’ve done a similar thing many times but in this case it seems that when the new iteration begins and the new URL is passed, the node still ‘remembers’ the structure of the last file read, even though the preview shows the correct headers and content. Error reported is of form ‘ERROR File Reader 0:1841 Execute failed: For input string: “S1400013” In line 2 (Row0) at column #0 (‘CODIGO ARTICULO’).’ In this case the column ‘CODIGO ARTICULO’ was in the previous file read ?

I know that this is a bit short of info and I’ll keep digging. I’m pretty sure I have the loop wired up right but putting this out there just in case anyone else has experienced it…

I’ll come back with more information or solution if I find it.

Hi @Steve.Thornton,

Welcome back to the forum.

Is it possible for you to provide your workflow with some sample data files?
So it would be possible to reproduce the error and check what is wrong.

:blush:

Hi ! Thanks for reply - and the welcome back : )

The workflow is a little complex to provide as it stands but I’ll try to simplify to have tabular inputs where paths are currently derived from network connections. If I can produce using this approach I’ll post that version.

2 Likes

OK, I cut it down to the bare minimum and it still seems to be behaving the same way. Also tried it on another machine… Originally the inputs were csv files but these are not allowed for upload so I changed it to use the 3 uploaded .txt files, again behaviour seems the same…

file_audit_test.knwf (19.1 KB)
input.txt (747 Bytes)
mill_clean.txt (1.8 KB)
article_clean.txt (2.8 KB)

Capture

.

Should have added that the txt files should be placed in folder c:\work

Since the table structure is changing, You have to use CSV Reader instead of the File Reader node and the problem will be solved.

:blush:

4 Likes

Exactly … it’s poorly documented I agree. The File Reader node stores the table spec internally and does not update it, which is why all your tables have the same column names. I expect that all your files have the same format, otherwise the Reader would have thrown an exception.

As Armin said, simply replace the File Reader by a CSV Reader and everything should work as expected.

4 Likes

OK ! Many thanks. I’m surprised I didn’t notice this before but this project is a bit unusual in that much of the data is being provided in this text format. As you imply, it may be that I have done something similar before, looping through files with the same format and so didn’t notice, in this case however they are all different as I am looping through them actually to create a reference dictionary/

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