Add to Dictionary: the expression does not produce a value

Hi everyone!!

I ask you, kindly, a hand for a problem I have encountered but which I can not understand.
As you can see from the image, I’m trying to add a value of type String.String to a list value inside a dictionary. But UiPath gives me an error with the following words: The expression does not produce a value.

I can not understand why you give me such an exception, neither how to solve this exception.

If someone can help me, I kindly ask you to come forward
Thanks in advance for the help.

Regards.

@momi_fede

List.Add(Variable) Will not return Value.

Add the Value to List by using Invoke Method.

Then you Assign value to to Dictionary.

Regards,
Mahesh

hei

Thank you for responding to my request.
Can I kindly ask you to be a little more precise?

For example instead of invoke method if I used add to collection change something?

@momi_fede

Yes you can use AddToCollection to add elements.

After Adding Elements to Collection(List) Then Assign the List to Value of Dictionary.

Regards,
Mahesh

to be honest my problem lies in the fact that I would have a list of arries of strings and I do not know how I should do except that for my problem I should use the add to collection and add to dictionary.
Can I ask you, if you want, an example?

Thanks

@momi_fede

If you are having an array of string arrA
Then Convert the array to List ListA=arrA.ToString
ListA is List Of Strings

Then Use Add To Dictionary
Key=“Test” (As You mentioned in Image)
Value = ListA

Regards,
Mahesh