For Each: Unable to cast object of type 'System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]' to type 'System.String'

Hi UiPath Community,

I am following the RPA Developer Foundation Training on the Academy. I am learning now more about data manipulation. Yesterday I had some difficulties with practice 3 - dictionaries & integers. This morning I created my own exercise with World Cup winners.

I now get this error: For Each: Unable to cast object of type ‘System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]’ to type ‘System.String’.

I checked it with the practice of yesterday and everything is exactly the same and don’t know why I get this error. I read other topics but was not able to find the solution. Could you please help me out?

Practice 3.1 - Dictionaries & Integers.xaml (8.7 KB)

Thank you!

@jorisveldt Use worldCupWinners.Values in the For Each instead of worldCupWinners and check

3 Likes

Thanks, I missed this!

1 Like

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