Hello. I’d like to know how could I realize an operation in the columns using their values. What I need to do is the following: in the image, the 3 first columns are related, and the 4 others too. So I’d like to do the verification as follows:
If between the values of the columns YZ45, ZY and YZ there is more than one equals to 1.001, I set them all to 0.001 and then I set a random one to 1.001. So for example, after doing this operation in the case of the image I’d have 1.001 for the YZ column and 0.001 for all the others (or vice-versa).
The same operation should be done regarding the four other columns.
I’ve succeeded to do it using the Python Script (1 => 1) node but its execution is very slow, and I need to run it a lot of times so it’s a little bit annoying.
I hope I understood your question well. Because I’m not so into “Java syntax”, I tried to find a solution in another way. I created this workflowchange_column_values_based_on_condition.knwf (75.0 KB).
First it checks if 2 out of the 3 columns (YZ45,ZY,YZ) have the value of 1.001. If that is false nothing happens. If it is true then every row is looped. In this loop a random number is generated between 0 and 6 (7 columns). With the Column List Loop every iteration (=column) is checked if its matches the random number. If it matches the column receives the value 1.001 otherwise 0.001. At the end of the wf everything is appended and concatenated together.
Thanks for the effort, it’s an interesting approach but it considerably increases the workflow just to solve a simple problem. I’ve posted another question that summarizes my global problem, I’d be happy if you want to take a look at it
maybe I’m missing something but this doesn’t seem as a simple problem. I mean it does not contain complex logic but sure isn’t standard data manipulation. So going with scripting (Python, Column Expressions) seems reasonable in this case.