Use of variables (column selection)

Hello - I am in finance and run reports on a monthly basis. I’ve pivoted my data on the dates so that each month represents a column (e.g., 202405, 202406) with the corresponding revenue.

I want to make it so that when running the knime workflow each month, the person running it only has to type in one area (I believe this is the purpose of flow variables) the month they are interested in running analysis on, then in all of the corresponding “Column Splitter” sections, it uses that flow variable to only select that column while removing the others.

I’ve watched a few videos on FLow Variables, and have even read multiple posts and I am still struggling to understand how to do what I am looking for.

Could anyone be so kind in helping me with step by step on what tools to use to a) create the variable, and b) use that variable in the column splitter to achieve what I am looking to do.

Thank you very much in advance for your help and patience with my ‘novice-ness’ :slight_smile:

Hello and welcome @mvttcorn5721,

This is one of those scenarios that depends on the data on what you want your users to be able to do, but for selection Widgets & Flow variables will be the best so you’re on the right track.

Flow variables are used to control the ‘flow’ of a workflow and here I’m taking the outputting selection of a number 1-12, manipulating it just so that it is always two digits (02 vs 2
and then using that to filter down the columns being displayed so that the columns must end in the selected number.
image

I only added 4 months here.

selection.knwf (15.7 KB)
)

Regards,
Wali Khan

1 Like

Thank you so much Wali for your help!

Since I am just starting with the use of variables, would you be so kind in listing out some steps I can use to achieve my desired results? For example:

  1. Column selection: Use node XYZ and select column you would like to use
  2. Variable use: In “Column Filter” tool, go to advanced settings > xxxxx
  3. Etc.

I thought it may be helpful to show what my data looks like when I input it, after I pivot it, and my desired state. Please see the below.

Data imported into workflow (period_name is what I would like the user to change each month within a node, or be prompted to choose)
Imported Data

Data after it is pivoted

Ideal state
Ideal State

Thanks → You could either:

A. Use the Column Selection Widget to have them select 1 column to keep, before sending the output to a column filter node
B. Use the Column Filter Widget – KNIME Community Hub to filter out everything but the columns they want to keep

1 Like

Thank you Wali!! Exactly what I was looking for. Really appreciate all your help.

1 Like

No problem - glad to hear it!

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