Dictionary.ByKeysValues - duplicate keys

I’m using a Dictionary.ByKeysValues node.
I’m importing a spreadsheet received from a client, so I’m not surprised the data isn’t perfect.

My problem is that the node blows up completely if there are any duplicate Keys.
Obviously, I can’t HAVE any duplicate keys, but I’m wondering if there’s some way I can make the node be a little more forgiving, and just ignore any duplicates instead of blowing the whole thing up.

They way it works now, is, if I have just a single duplicate key (in this case, out of 2400), I get 2400 null values

Is there ANY way to accept the 2399, and ignore the one?

List.UniqueItems ?

Thanks. I had thought of that, but since my Keys are coming from one list, and my Values from another, how do I make sure that the Values are still matching the Keys after removing some of the keys?
UniqueItems doesn’t have a “Retain index” option

Maybe this could work?

2 Likes

Some nodes to think about:
List.UniqueItems
List.Count
!= 1
List.FilterByBoolMask
List.AllIndiciesOf
String.Join
List.Join

Theres some added list management nodes in there too but that set should get you started. :slight_smile:

Jostein; that’s exactly what I was looking for thanks!
My graph (eventually) will be used to track what people are in which Room.
The problem is that sometimes people share a room, or there are multiple people in one space
The dictionary can only have one Key (the Room), so
I added one more branch to the graph so I can report on any “extras”
Now all I have to do it figure out how to report that back to the user. Spreadsheet, I guess