Column sorting via flow variable

Hi @all,

I’ve only been working with KNIME for a short time and I’m currently failing to sort my columns using a flow variable.

Let’s say I have 3 columns: Column 1, Column 2, and Column 3 and I want to put Column 3 in the first place using the flow variable.

It does not work with the Column resorter, how can I proceed?

Hi @IlariaL,

why does the column resorter not work?
Does it not have the option you need in the flow variable config? (not sure cannot check at the moment :see_no_evil:)

Do you have an example workflow for your problem? :slight_smile:

Hi @AnotherFraudUser,

I think the column resorter node does not work because I can only define ColumnOrder by flow variable but I need a special column at first place which name depends on the input of a sting input variable
I will try to make an example workflow

great - if you have an example workflow - then’ll look into a possible solution for you :slight_smile:

1 Like

First of all how can I upload an example workflow :slight_smile:

Export the workflow from KNIME as a knwf and drag and drop the file in your next forum message window.

1 Like

Alright thank you.
Column-Sorting.knwf (16.2 KB)

Hi @IlariaL,

attached your workflow with an example how to sort the columns.
Not the prettiest solution - but this works at least :slight_smile:


grafik

Column-Sorting.knwf (24.8 KB)

I think what you missed - is that you need to have an string-array with all columns (in the order you need) to sort it via variable.

For the binning i am not quite sure how to do it (as I never used it before :thinking:)
It seems beside the column array you need to provide the column-binning-config as a separate variable

2 Likes

Hello there,

indeed as @AnotherFraudUser said to control order in Column Resorter node one most create flow variable type array holding column names in order you would like to be sorted. But why is it important to control column order with flow variables @IlariaL?

Numeric Binner requires numeric column while all columns in example are string so won’t work with or without flow variables.

KNIME Hub is also a way to share a workflow. A easier and a cleaner one :wink:

Br,
Ivan

1 Like

Thank you all so much for your advice.
@AnotherFraudUser your approach worked perfectly fine for me :slight_smile:

2 Likes

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