Replicate the values to other cells if a condition is TRUE

Hi All,

I have three columns like this.

Col A Col B Col C
X X a or b
Y Y
Z Z

Here, Col C has two values (a or b). If Col A, Col B and Col C matches, Col C Value should be copied to other two rows of Col C.

I am trying to sort this out using the rule engine node but didn’t get the exact output I need, Can somebody help me to fix this?

Any help would be highly appreciated!

Thanks,
Jonam

Hi @JonamDeju

If I understood well your question, the following workflow should do the trick:

20220530 Pikairos Replicate the values to other cells if a condition is TRUE.knwf (26.5 KB)

The -Rule Engine- node checks for the condition only for the first row and if true, then it sets the “Column C” value. The -Missing Value- node feels the other rows with the “Column C” first row value.

Hope it helps. Otherwise please reach out again for further help.

Best
Ael

4 Likes

Hey Ael,

Thanks for your time!

What if the Col C values appear to be in the 3rd or 4th row. Can we still use this rowindex method then?

I have a data of 5 rows, Col C has a value in the 3rd row and all others cells of Col C are blank, If the 3rd row condition is true, I want to copy the Col 3 value to all other cells of Col C.

Does it makes sense? Or please let me know if you need any other inputs from me!

Thanks again for your help!

Cheers,
Jonam

Hey @JonamDeju

Yes indeed you can if the value appears just once in the column. Otherwise there is ambiguity.

The only modifications you need to do to the current workflow is to remove the RowId checking from the condition and use “the most frequent value” option in the -Missing Value- node.

Hope it helps.
Best
Ael

4 Likes

Perfect!

That worked like a charm!

Thanks so much for your time Ael. Appreciate it!

Cheers,
Joam

1 Like

My pleasure. Thanks @JonamDeju for your kind comments and for validating the solution.

Best wishes,
Ael

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