Dictionary question

Hi,
I have a dictionary with a key and an array of strings as values.

So the dictionary is defined as
new dictionary (Of String, String)

Key is the employee id and values in the array are name and job title.

How do I retrieve values from the dictionary.
I am trying dictionary(id)(0) and dictionary(id)(1) but it is throwing an error.

Thank you.

Hi,

Can you share content of the dictionary?

Basically, we can access it by your expression.

Regards,

Thank you, @Yoichi

I am adding to dictionary dynamically this way. Is this correct?

id, name, title string variables.

dict(id) = {name, title}

Thank you so much,

Hi,

It seems no problem. What error do you have?

Regards,

@Yoichi
When I am retrieving, getting an error saying cannot assign dict(id)(0) to var_name

var_name = dict(id)(0)

Thank you

HI,

Do you use Multiple Assign activity? If so, can you also check content of $exceptionDetails at Locals panel when exception occurs in debug mode?

Regards,

@Yoichi
I need to add bunch of employee ids and name, title for each employee.
May be I am not using the dictionary properly.

Can you please suggest a good way?

thank you,

HI,

The following sample may help you

Sample
Sample20240926-3.zip (3.0 KB)

Regards,

2 Likes

@Yoichi
Thank you. I was not passing the needed argument. Debug helped. Code is correct.
Thanks for the help.

1 Like

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