Compiler Error(s) encountered processing " winner.values >1 "

Hello

Compiler Error(s) encountered processing " winner.values >1 ", operator '>' is not defined for types' system.collections.generic.dictionaries(Of string, Integer).value collection and integer

Im going though RPA developer program under Data manipulation Section Exercise - on Dictionaries & Integer _combination I could get error at last
where I check the condition ‘>’ 1

WinList is a Dictionary of < String , int32>
Here key is String
Value is Integer

So when I call Winner.Value > 1 gives an error

for me > operator is not recognising.
Can anyone facing same issue?

You must check a condition in an If statement. Do not write the condition to the output in the Write Line activity.

I have modified and checked the same issue…

previously I was checking the result what could be the output if I pass it through writeline.
Anyway, now I have changed and added under if condition… still not working…

if I download from the exercise the demo is working… But when I reproduce the same I do get this error.

Remove .Values from Winner.Values.

Also, if you get any other errors, please share the error as well.

Yes, Here is the error screenshot

if hover the mouse on the error I see as below

**Compiler error(s) encountered processing expression " Winner". **
**Value of type ’ system.collection.generic.Dictionary(Of String, Integer)’ **
Cannot be converted to Boolean

Do not remove > 1. I notice that WinList is a dictionary. Use Winner.Value > 1 instead of Winner.Values > 1.

Yes, I see error

Compiler error(s) encountered processing expression " Winner > 1"
Operator ‘>’ is not defined for types
‘System.collection.generic.Dictionary(Of string, Interger)’ and Integer

Once again same issue

Ok, try this.

Change WinList in your For Each activity to WinList.Keys. Then in your condition, write WinList(Winner.ToString) > 1.

The Error is gone… But started another issue

just to update I see that, For loop Type Argument shows

"System.Collections.Generic.Dictionary<System.String, System.Int32>
Does it hold good or do I need to change here?

Change the Type argument in the For Each loop to String. I think it’s currently set to iterate over dictionary items.

OK… Now I have changed the Type Argument as String to FOR Loop.

the Condition now not showing Winner. Does not shows Value as dot Operator

and if I write as below Winlist(Winner.ToString) > 1 then to print required details I wont get keys and Values. I get to see below error

the Expression I wrote in annotation area to get more information

Change Winner.Keys to Winner, and Winner.Values to WinList(Winner.ToString). Not sure what is in the Write Line statement to the right, but if it is similar, do the same for the Write Line activity as well.

I see below error

Write line gives if dictionay has similar names then count for those names would be 1 and if same name of the winner person more than once then that count would be displayed

Change WinList to WinList.Keys in your For Each loop.

Perfect, It worked…

The Output is as below

Capture-10

by the way…
why operator was not taking with earlier situation ? what is the cause

this was the input

Initialize a dictionary of type (Int32, String) with the following value - New Dictionary(Of Int32,String) From {{2006,“Oscar Pereiro”},{2007,“Alberto Contador”}, {2008, “Carlos Sastre”}, {2009,“Alberto Contador”}, {2010, “Andy Schleck”}, {2011, “Cadel Evans”}, {2012,“Bradley Wiggins”}, {2013,“Chris Froome”}, {2014,“Vincenzo Nibali”},{2015,“Chris Froome”},{2016,“Chris Froome”},{2017,“Chris Froome”}, {2018,“Geraint Thomas”}}

I think it had something to do with the way the values were being pulled from the dictionary. I’m sure there’s another way to iterate over the data than what I recommended, but I’m less familiar with iterating over the dictionary objects rather than the keys in the dictionary.

Thank you very much