Unable to convert keys of a dictionary to an array

I am working on a database with the following structure:
The database is a Dictionary with the key of String type (the names of the persons) and the values of Dictionary (String/Cities, Double/Weight) type.

I am trying to calculate and print the sum of weights for each city which will be stored in a second dictionary using for each activity

Lastly using an Input Dialog activity, the user will be given a list of cities(keys from the second dictionary) and based on their choice the corresponding weight will be displayed.

For the last activity, I keep getting the error Value of type ‘1-dimensional array of String’ cannot be converted to String as I try to get the cities using dict.Keys.ToArray

I am not sure how to fix this or what the workaround to this problem is. Also, I am unable to attach my workbook but if anyone would be interested in
helping me or any inputs would be much appreciated!

@geetika.s
welcome to the forum
give try on String.Join(",", dict.Keys.ToArray)

or use other setting Options:
dict.Keys.ToArray

  • Options - An array of options to choose from. If set to contain only one element, a tex box appears to write text. If set to contain 2 or 3 elements, they appear as radio buttons to select from. If set to contain more than 3 items, they appear as a combo box to select from. This field supports only String Array variables.
  • Options String - A string containing options to chose from. If set to contain only one element, a text box appears to write text. If set to contain 2 or 3 elements, they appear as radio buttons to select from. If set to contain more than 3 items, they appear as a combo box to select from. This field supports only String variables.

https://docs.uipath.com/activities/docs/input-dialog

1 Like

THANK YOU!! Wasn’t aware of the different input options that the Input Dialog activity accommodated. Fixed the issue by using the Options input instead of the Options String.

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