i’m trying to debug codes, but i have a hard time finding errors because console.log doesn’t create any output. I tried with a completely new node which only contains console.log("Hello");, but even this doesn’t show up in the console.
I set LogLevel to debug. I also tried to define an output flow variable, but the cell which should contain “Hello” is empty. I get no error message at all.
Well, turns out the question is about JavaScript, I guess I just can’t read
Sorry my post was not useful. I was looking for a way to write to the console but didn’t find anything.
logError(“Hello”); obviously doesn’t work.
neither does console.log(“there!”);
If you switch over to the Column Expressions node you’ll even get a nice error message telling you those functions don’t exist: No function 'logError' with 1 argument(s) defined.
Kind of whacky, but can you try to write your debug messages to the html of the JavaScript view?
I don’t know how to do that, but maybe the knime.log i already posted is sufficient? Like i said, i can’t see anything related to console.log in there. The code only consist of out=console.log('Hello'); out;
Edit: to be a little more clear about what i’m trying to do. I’m trying to recreate the following tutorial to get into JavaScript/D3 programming: Creating Simple Line Charts Using D3.js - Part 01 | Welcome to Vizartpandey
I obviously need to change some things in the code suggested. Instead of reading a csv i just put the data into a table creator. But i’m struggling with understanding how the dataset is written into variables in the Generic JavaScript view. It seems easier to me to adress the single columns in the dataset with the given commands then to transform it into a JSON-format like the outdated KNIME-Tutorial suggests. But i need to see what the variables actually consist of to continue because the error messages suggest that the variables are not filled with data in a correct way (‘Cannot read property ‘length’ of null’ etc. → seems, that the way i read the column doesn’t create an array but an empty variable)
The tutorial suggests to write ‘console.log(xAccessor)’ to understand what is happening at this point. But as long as this doesn’t generate any output i won’t be able to understand the rest of the code completely.
Sorry for putting this into an additional post, but i can’t edit my other posts anymore.
I found a workaround with the ‘prompt’ command.
I feel that console.log() isn’t supposed to write anything into KNIME-console but is used for interactive consoles like when i open the resulting html-file in a browser. I also can’t get it to run there, but using ‘prompt’ inside Knime will do for now. I’ll still be happy if someone could explain how to write something into KNIME-console because that would still make stuff much easier.