Replacing a list with list of keys


Is there an easy way to replace a list with a keyed index of the unique values?

Example List

{A,A,B,K,J,B,C,D,A, A, A}

Unique Values get assigned an index based on sorting them numerically or alphabetically (in this case).

A-1, B-2, C-3, D-4, J-5, K-6

Replaced with

{1, 1, 2, 6, 5, 2, 3, 4, 1, 1, 1}

Thanks for looking at this!




I built this node a while back (package Clockwork), not sure if in the meantime they have added a built-in node for that sort of thing.



Thanks Andreas, that will work.

I can generate the list of unique values, then generate the keys from a count/create list.

I’ll report once I put it into my procedure to color 3d views by parameter.