I’m trying to use the Column Selection widget to feed a selected column to a bar chart. I get the following error. Any help would be appreciated.
Node: 51:0:55
Message: Error in script
TypeError: Cannot read property ‘length’ of null
TypeError: Cannot read property ‘length’ of null
at processData (eval at fn (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//org/knime/dynamic/js/dynamicJSNode.js:103:37), :657:44)
at drawChart (eval at fn (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//org/knime/dynamic/js/dynamicJSNode.js:103:37), :221:13)
at Object.window.knimeGroupedBarChart.barChart.init (eval at fn (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//org/knime/dynamic/js/dynamicJSNode.js:103:37), :108:9)
at file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//org/knime/dynamic/js/dynamicJSNode.js:108:41
at Object.execCb (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:29:229)
at X.check (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:18:423)
at X. (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:23:9)
at file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:8:70
at file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:23:369
at y (file:///C:/Users/genef/AppData/Local/Temp/knimeViewContainer54901//js-lib/requireJS/2.1.8/require.js:7:172)
@rfeigel
I can confirm that there is something wrong with resetting the Bar Chart node while the aggregation mode is “Occurrence Count” (there is also a typo in the node’s configuration). The node displays everything well in the first run but as soon as you choose another column, everything goes wrong.
But still you have other options to do the same thing. You can use Constant Value Column or Math Formula to add a new column with a constant value of 1 and then in the Bar Chart node set the aggregation to “Sum” and include the new column. So it works the same as occurrence count.
Or you can use a GroupBy node, include the selected column using flow variables (as grouping column) and count one of the other columns (you can count ID and don’t forget to filter it before the column selection widget).
To KNIME: The node takes the values of the included column as the result of the aggregation only if the same column is chosen as the category column. So to reproduce this error you need a numeric column and include it in the Bar Chart node and pass the column name as variable to the node configurations and set it as the category column as well. Then you see the values of column as occurrence count. If the category column and the included column are not the same, the node throws an error when it gets reset in the same view. Closing the view and opening it again with the new configurations will not cause any errors.