Spread to dictionary

Hello,
is there a simple way to convert a two dim spread to a dictionary? I thought I can do it via FromSequence, but I don´t now how.

Matthias

Hello @matthiasz for simple dictionary you need a KeyValuePair like this

image

in your case you have either to iterate through all of your spread’s items or to create a Dictionary<Int32, Spread<Spread<*>>>

Hello nissidis,
thanks for your help. Is there a way to create a Dictionary directly? In my case, value and keys are Strings, a non-changing, constant list. I thought there ist no direct way to define it, so I have to do it via spreads. But if there is a way to define the dictionary directly it would be nice.

Matthias

can you upload the patch with the spread that you want to convert to a dictionary?

Here ist the spread I want to convert to dictionary:
Spread_Dictionary.vl (3.2 KB)

Further on I want to send the caharakters (the values) to an arduino via websocket. Thist part of the program ist working.

Two options in your case,
either use the overload of FromSequence with Key Selector and Value Selector
or use a Cons node and rename the inputs.

See modified patch
Spread_Dictionary.vl (14.1 KB)

Great! That helped me. I will work with the overload FromSequence, even it´s hard to understand for a beginner in vvvv gamma. Some more documentation would be great, but thats a lot of work, I know…, So thanks a lot, that you helped me so fast!

Matthias

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.