Output Python edit variable

Hi,
Does anyone know if it is possible to get output from Python edit variable node, in new column?
I use this node to compare two columns of string and get the difference between the two strings.
However, just visualize this result here:
image
I would like to visualize it in a new column, in which I see the difference between the strings for each row, so that I can use a loop and be able to do it massively

Hi @daviddelos,

if I understood well then answer is no. But why is this stopping you from using loop and doing it massively?

Br,
Ivan

Hi @ipazin ,
Because I can see the script results only in the standard output of the Python edit variable node, and this is only displayed one by one, if I put an end of loop, in this I can only see the input columns to the Python node, at the end of the loop I don’t see the results of the executed script.

That is why I am trying to find a way to display the Python results in a new column.

But I see that according to what you tell me it is not possible.

Also thank you very much!

Maybe you could tell us what you want to do or give an example we could think about possible solutions. In this example a table with 5 lines is created, then a Python Edit Variable node is used and the result is stored in a constant value. And this is done for every line. The results are collected in the ende. Not very elegant.

Maybe if you have some Python tasks you could try and do them within a python snippet for all your relevant lines at once.

kn_forum_python_edit_variable.knwf (20.1 KB)

1 Like

Hi there @daviddelos,

not sure I understand your use case so agree with @mlauber71 that example would help. Additionally maybe Variable Loop End can help cause it is collecting variable values at loop end.

Br,
Ivan

1 Like

Hi there @ipazin, @mlauber71.

Look at this workflow, it shows an example of what I want to do:
KNIME_PythonEditVariable.knwf (39.7 KB)

You can see that in the end node (end of the loop), I can’t display the results of the Python variable edit node. This result I can only visualize here row by row, in each iteration:

This result shows me exactly what the two tables don’t match.
I would like to be able to capture this result for all the iterations at once, overwriting in a new column

In pure KNIME terms what you have to do is give the result to a flow variable that can later be handled. I am not 100% sure this is the best solution for your problem, but you will have the result in a string column collected.

I have not looked into it but maybe you should think about employing the difference function in another way so to handle more cases at once.

KNIME_MRC_2.knwf (41.7 KB)

1 Like

Hi,

but why using loop and Python Edit Variable and not Python Snippet node so you avoid loop? Also Java and JavaScript offer various string difference function

Br,
Ivan

1 Like

Hi @ipazin,
In fact I had already tried using the Python Snippet node but it didn’t work for me. I had never worked with this one.
Could you show me how would you do this comparison between two lines?
Thank you.

Hi there @daviddelos,

no I can’t. At least with Python as not a Python guy :smiley: But can share workflow using Column Expressions with two examples (which I found online!).

KNIME_PythonEditVariable.knwf (76.7 KB)

Hope this helps!

Br,
Ivan

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