Advanced FLowvariable Usage in Pivoting Node

I’m trying to use Pivot Node with flow variable customization.
According to previous variable I’ve to aggregate data in different ways so I would use flow varialbes. I’ve read the topic [solved] Using flow variable in Pivoting node but it’s not good for my cause.
In that topic the solution is the creation of aggregation variables by standard interface and the override of them by flow variables.

In my scenario, the number ov aggregaion variables is … variable so I cannot populate agggregation column interface.

When I opened PivotNode flow variable interface I’ve found the aggregation column section
In this section I can see 4 variables:


So I created 4 string array variables (according to types listed in image). Then I passed them to node.


The problem is that, with this configuration, the node display a configuration error with this stacktrace (exracted by a verbose logging).

> 2020-04-24 16:58:06,090 : DEBUG : KNIME-Worker-45-Table Row to Variable 0:32 :  : Node : Pivoting : 0:34 : Errors loading flow variables into node : String for key "numericColumnMethod" not found.
> org.knime.core.node.InvalidSettingsException: Errors loading flow variables into node : String for key "numericColumnMethod" not found.
> 	at org.knime.core.node.workflow.SingleNodeContainer.applySettingsUsingFlowObjectStack(
> 	at org.knime.core.node.workflow.SingleNodeContainer.access$2(
> 	at org.knime.core.node.workflow.SingleNodeContainer$1.preConfigure(
> 	at org.knime.core.node.Node.configure(
> 	at org.knime.core.node.workflow.NativeNodeContainer.performConfigure(
> 	at org.knime.core.node.workflow.SingleNodeContainer.callNodeConfigure(
> 	at org.knime.core.node.workflow.SingleNodeContainer.configure(
> 	at org.knime.core.node.workflow.WorkflowManager.configureSingleNodeContainer(
> 	at org.knime.core.node.workflow.WorkflowManager.configureNodeAndPortSuccessors(
> 	at org.knime.core.node.workflow.WorkflowManager.doAfterExecution(
> 	at org.knime.core.node.workflow.NodeContainer.notifyParentExecuteFinished(
> 	at org.knime.core.node.workflow.NodeExecutionJob.internalRun(
> 	at
> 	at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(
> 	at org.knime.core.util.ThreadUtils$
> 	at java.util.concurrent.Executors$
> 	at
> 	at org.knime.core.util.ThreadPool$
> 	at org.knime.core.util.ThreadPool$
> Caused by: org.knime.core.node.InvalidSettingsException: String for key "numericColumnMethod" not found.
> 	at org.knime.core.node.config.base.ConfigBase.getString(
> 	at org.knime.base.node.preproc.groupby.GroupByNodeModel.loadValidatedSettingsFrom(
> 	at org.knime.base.node.preproc.pivot.Pivot2NodeModel.loadValidatedSettingsFrom(
> 	at org.knime.core.node.NodeModel.loadSettingsFrom(
> 	at org.knime.core.node.Node.loadModelSettingsFrom(
> 	at org.knime.core.node.workflow.NativeNodeContainer.performLoadModelSettingsFrom(
> 	at org.knime.core.node.workflow.SingleNodeContainer.applySettingsUsingFlowObjectStack(
> 	... 18 more

Can you help me?

Hi pigreco,

which Version of KNIME are you using?
I think the problem is that one column you are using is not supported by the assigned aggregation method
Or the column name you are giving in the field columnNames does not match the given type
->do you need to put in the columnTypes?
…However this is justed guessed from the error message :grin:

I tried to somewhat do the same as you (in my Version it does not seem like I can give the columnTypes via. array -> therefore the question :slight_smile: )
flow_pivot_example .knwf.knwf (16.5 KB)

Could you maybe give your workflow as an example without real data? Maybe that makes it easier to check what is wrong

the version is not the problem. (I use last 4.1.2)
If you try to open flow variables tab after you add aggregation column, you cannot pass columntype as array (you’re forced to enumerate all column types).
But if you remove all aggregation columns in tab "manual aggreagation " and then re open flow variables tab, now you can pass all aggregation params as arrays.
Try it if you can.

In the meantime I’ll prepare a sample workflow.

ah okay :+1:
yes - will try to help you based on your example!
Does not have to be anything major - just something where i can get the error by myself :slight_smile:

Hi @pigreco

I was reading through this, and even so it is possible would not recommend using the flow variables for this case. Maybe we can find another solution together.

What are you trying to achieve? How is the mapping from Column Names to Aggregation done?

1 Like

Hi Iris,
I want create a component usable to process a lot of data organized by date.

For example, COVID data:
so in the first case I’ve for every cities three variables
in second, for regions I’ve 6 variables.

The goal is display data in a line chart but, in the first case I’ve to plot 3 lines but in the second 6 variables.
My component is parametrized by file (or directory name) and an array of column names.

So I’ve to parametrize Pivot to choose the variables to aggregate.
Thanks a lot.

I would loop this.
If you use a Column List Loop Start and end this with Loop End (Column Append) you have the same effect and do not need to hack the flow variables into the pivoting node.

Thank you. I’ll try it later :slight_smile:

1 Like

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