Dynamic deletion of columns without losing column order

Hi, I use KNIME version 4.9 locally. I try to delete some some columns dynamically without losing the order of the colum,ns.
I have 2 tables:

  • One large dataset that incluse many numerical columns line 122, 123, etc.
  • One table having only one column that indicates which columns are to be deleted, e.g:
    DeleteColumns
    122
    123
    132

A reference column filter would be ideal for this, however it doesn’t just delete the coulmns in the main table, it also changes the order of the columns. I have been trying hard to do it in another way, e.g. by using a variable in a column filter, however this failed.
I also tried with Transpose - Join - Transpose, but this also changes the order of the columns
What would be the best way to solve this?
Thanks.

Hi,

so you have something like

TableA:
id col1 col2 col3 col4

TableB
ColsToDelete
col2
col4

and want to have
id col1 col3

but have now
id col3 col1

?

Hi @Dhiradj

Did you also checked out the :

gr. Hans

1 Like

Hi,
Correct, e.g. I have now table A: 121, 122, 123, 125, 126, 131
Tabele B
ColstoDelete
122
123
With the reference column filter the order becomes
121
131

125 and 126 have (correctly) not been deleted, but are now moved to the back of the numeric column names.

Hi @Dhiradj

See if this wf dynamic_deletion.knwf (66.2 KB) does work for you.

gr. Hans

1 Like

Thanks all, the issue has been solved!
Contrary to what I thought, the reference column filter did not disrupt the column order; a column resorter that was before it and not updated after I added some new columns did.

2 Likes