ERROR Loop End - Execute failed: Input table's structure differs from reference (first iteration) table: different column counts 21 vs. 20

Hello All,

I’m facing an issue with handling columns in each iteration. Since these columns are dynamic, I cannot select or control them from the JSON data. However, I need to run the loop without failing to collect all the data. How can we handle mismatched columns in KNIME?

Hi @kotlapullareddy,

I faced similar issue when I did pivot in a loop as there are no transactions in certain months and hence the iteration was failing because those columns were not getting created. However, I clearly know all the column names. Hence, I created a dummy Table Creator and concatenated the columns before providing it to the loop end node. After that the iteration never failed.

The condition here is that you should know the column headers before-hand. If you know them, you can take up this technique.

Note: There can be better ways to handle this. However, I could only think of this approach to achieve my goal.

Thanks @kamtaot can you please share if you have any sample dataflow.

@kotlapullareddy,

I am sharing two screenshots for your reference. Please check if they are useful.

In the actual workflow, I pivot the data. Then in the second screenshot, I created a dummy table and concatenated it to the actual data.

Final output contains all the columns, and the loop went perfectly.

1 Like

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