move first value encounter to the top

Hi all,

I have a list of patents in a column, some of them are repetitive too. Is there any way to move the first encounter of a value to the top. In this way all the unique values will come to the top of a column.
To make it more clear, I will explain how I did it in excel. I used a formula in the adjacent column of my patent column which returns false whenever a value encounters for the first time and returns true if value encounters second time. Then I sorted the column. In this way all the cells having false values come to the top and in the adjacent column all the first encounter patents. I hope my question clear. Thanks in advance.

Regards,
Pardeep

If I understood correctly, this sounds like a case for the GroupBy node – I’d aggregate the values into a Set which will give you a ‘Collection’ type column with unique values. To roll them back out into individual rows, you can make use of an Ungroup node:

36

Best,
Philipp

Hi Philipp,

Thanks for the answer. I am using GroupBy node but the result is the table having unique values only. Actually, I do not want to remove duplicate values, I just want to shift them down i.e. in the start all the unique values and then duplicate values. I hope my question is clear.

regards,
Pardeep

How about using a group by and count the occurances and join the no back to the data and then sort it

kn_example_move_first_value_to_top.knwf (26.7 KB)

Thanks for the answer @mlauber71. The answer is almost same to what I want, except the value column should look like f,g,i,k,l,o,u,z,p,a,b,c (all unique values),p,a,a,b,b,c,c (repetitive values). I guess I didn’t make my question very clear. Apologies for the inconvenience.