Looping through an Array of dictionaries

Hi Guys,

I am trying to use a For Each activity looping trough an array of dictionaries. I have a variable in which I stored all my dictionaries. Unfortunately, when I try to use the “Key exists in dictionary” activity it says dictionary not initialized. The dictionaries have been previously initialized outside of the “For Each” activity

I tried to iterate an array of dictionaries like you show in the screenshot, and there was no problem: TestArrayOfDictionaries.zip (2.3 KB)

How are you initializing the dictionaries?

@Mateus_Cruz
we can also try like this, it may work

You can extract all the keys from adictionary by using Dictionary_Variable.Keys.ToList

And you can check whether the key is present are not by using List_Variable.Contains(“Key Variable”) function.

where ever you are using dictionary you have to initialise in the beginning by new Dictionary(Of System.String,System.Int)

Regards,
Mahesh

1 Like