Dictionary from list inversed

does anybody have a idea what is wrong in this script. The keys are reverse order.

by the way; the underneath values are correct, but i need the top level also in the correct order, so first bar and then cafe, and i cannot just inverse them, because finaly those values comes from an excel file.

Dictionaries don’t have an order and are not an iterable item - you have to explicitly ask for “bar” for “café” to pull the relevant data, and then preform the action.

So in your case if you want to get a data from the café key, you’d have to pull the keys using a Dictionary.ValueAtKey node, or design script Dictionary.ValueAtKey(dict,"cafe"); or dict["cafe"];

If you want data in a given order you need to feed the keys in the desired order - so in your case dict[["bar","cafe"]]; would get the data in the correct structure.


thanks, oke. I am new to dictionaries.

1 Like