Get index of a list

So I have two lists

The first lists contains 96 elements but only 14 of then are unique elements (the other 82 elements are just repetitions of these unique elements)
The second list contais 14 unique elements (the same unique elements of the first list)

What i want to do is:
Create a third list wich has the same amount of elemens of the first list like this:
If element 1 of list 1 equals element 1 of list 2 than write 1 in element 1 of list 3
If element 1 of list 1 equals element 2 of list 2 than write 2 in element 1 of list 3
If element 1 of list 1 equals element 3 of list 2 than write 3 in element 1 of list 3
If element 1 of list 1 equals element 4 of list 2 than write 4 in element 1 of list 3
If element 1 of list 1 equals element 5 of list 2 than write 5 in element 1 of list 3
If element 1 of list 1 equals element 6 of list 2 than write 6 in element 1 of list 3
.
.
.
If element 96 of list 1 equals element 14 of list 2 than write 14 in element 96 of list 3

@ramoon.bandeira Something like this?


RepeatCount.dyn (7.4 KB)

Unfortunately Not

1 Like

I think i haven’t made my question clear enough so that you could understand.
I applied List.AllIndicesof to the list and i got a different list…
Sublists of list 1 are of composed of different amounts of elements.

@ramoon.bandeira Not sure if it’ll work, but, did you try what I’ve suggested above?
Consider the longer list to be List 1 and the shorter list to be List 2
You don’t need to use List.AllIndicesOf

1 Like

i tryed it.
But i’m too newbie in programming to understand what it means
and i haven’t got what i wished to get

Could you post a Dynamo file or screenshot that better explains your issue.
With expanded list 1 and list 2. Not the original large file, a simplified one, with fewer values.

1 Like

One approach to achieve this would be to create a dictionary where List 2 are the keys, List 3 are the values, and List 1 are the accessors. SpringNodes package includes a useful node Springs.Dictionary.ByKeysValues to create and access a dictionary all in one:

1 Like

3 Likes

How dictionaries functions works?
Thank you!

Hope this gives you some idea…

5 Likes

Thank you so much. I was searching all over for this node. Worked like a charm matching workset names to their ID numbers.