how can we select the column from the flow variable?

I need to use the sorter node by the column should be pick by the flow variable.
Can we do that?

Hi @PankajChaudhary

Yes there shouldn’t be any reason why not, but it looks like the sorter requires two array variables… One containing the names of the columns as Strings and the other containing the sort Order as Booleans. Creating array variables in Knime is the bigger part of the challenge, but not insurmountable, and the mechanism used for that will largely depend on what you are trying to do…

How are you intending on deciding on the columns for the sort order? Is it via user input, or some other process?

@takbb in sorter i need to pick the column from the flow variable in the Sort by section.

Hi @PankajChaudhary , sorry I didn’t word my question very well… I meant what process are you using to decide what values should be put into the flow variables?

Here is a demo workflow that uses a component to create the required Array flow variables. It turns out that a String[ ] flow variable containing true/false can be used for a Boolean [ ] parameter, so this can be done with a pair of String array variables.

My question about what mechanism you are using for deciding the content of the flow variables was about trying to work out the best way to populate them. Here I do it with components, but that might not be suitable for you.

Sort by flow variables.knwf (32.0 KB)

Can we use it inside the loop after(Column list loop start ). from which it can automatically take column from it?

Hi @PankajChaudhary , I’m not sure I understand your use-case.

Is the loop generating columns that you don’t know the names of prior to running the workflow?

From within your loop, what criteria decides which columns it wants to “automatically” sort by?

@PankajChaudhary, I think you need to be more specific with your question and what exactly it is you’re trying to accomplish. It would be most helpful if you provided whatever workflow you’ve come up with so far. At the very minimum, you should provide some example data and details about your desired output.

Otherwise we’re just guessing and wasting everyone’s time going in circles. No one here is a mind reader.

1 Like

Hello @PankajChaudhary,

Yes. In case you are only sorting your table based on one column you can simply assign string flow variable with column name to incllist. See bottom picture:


But questions and suggestions raised by @takbb and @elsamuel are valid and you should think about giving more context if possible.


Thanks it worked for me

1 Like

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