Dictionary - values and alternative ideas

I have a list of keys, very imaginatively called, “Type1”, “Type2” etc.
Each one has a value (so far, so good.)

However I have a list of values that I want to know what key they are and how many of each.

I want my output to be a count of each type:
So in the image it’d be
4 Type 1
3 Type 2
4 Type 3
5 Type 4
1 Type 5
0 Type 6

I have a count in the watch node on the far right but I don’t know which key each one is.

I could use the == for each value but I don’t like this (drawn red rectangle).

It’s easy to get the value from a key (green group)
But I don’t know how to get the key from a value (red group).

1 Like

It’s a great video but I’m missing how it answers my question. :neutral_face:

Something like this?


keys.dyn (11.6 KB)

4 Likes

That’s awesome! Thank you!

I think I was trying to force it into a dictionary as I never use them and thought it was about time I did. :smiley:

1 Like

Even python requires you to search the dictionary for matching values or an index to get the respective key. You can always use Dictionary.Components to get the keys and values and search/filter through those.

Let me humour you :slight_smile:

3 Likes

Haha! That’s cheating :joy:

1 Like

Ha! I almost told someone else to do that the other day. Work smarter not harder, right!?