Help with alternative to Dictionary activity in new version of UI-Path

In my legacy projects i have a process that loads an excel spreadsheet into a dictionary.

With the new version of UiPath this option is no longer available and I am struggling to understand what is needed to create this again.

I have searched in the Forum but its not straighforward as this is specifically for loading an input spreadsheet

If anybody could advise what or how to get this to work again would be greatly appreciated.

Here is the Window Legacy screenshot: -

Here is the New Windows result when it is converted

thank you for the reply but that doesn’t help very much as I am trying to create a dictionary from an excel input spreadsheet with up to 100 or more lines of data.

To create the dictionary I am using the AddToDictionary(String,Object) activity in the Windows Legacy project: -

So I need to process that will work in the new version as well.

we suggest to reread the the shared ressource

instead of the non-resolved activity it can be done with an assign activity
specificContent(item.ColumnName) = value.ToString

maybe you want to shift to LINQ as well - toDicitionary(… LINQ Operator
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

To clarify abit, it seems you are using a custom activity from a third party library, possibly from the marketplace.

I expect you have a missing dependency error in the dependencies right?

As Peter explained, it can be done in a simple assign activity and you do not need this activity, so its likely easiest to convert them to an assign, where you specify the dictionary and key name on the left side and the value on the right as shown in Peters example.

Try implementing that and get back to us if you get stuck.

Hi there,

I have tried to implement as requested but I am seeing an issue prior to reaching the updated sequence :smiley: . I have searched the forum and cannot find a specific resolution for it.

When debugging the new setup I am seeing a “Get Row Item: TypeConverter cannot convert from System.String” when the Get Row Item is being processed.

I’ve tried to adjust things in the Get Row Item but those then give additional errors, so to me that looks like the settings I have are correct.

Seems like a different error, I don’t see what part this is related to the dictionary activity you were missing?

This activity is looking at the imported excel datatable and for each row it will create a row in the dictionary so that each row will be processed by other activities further in the project.

From Legacy version

The Get Row Item is used to create a corresponding row in the dictionary

Sorry, its still not clear. You showed a missing activity and we indicated what you can do to replace it with an assign. I dont see what the get row activity has to do with that broken activity or where you error is coming from as it doesnt show a red mark on any activity.

Hi Jon,

So I cannot check to see if the solution suggested will work as I cannot create the dictionary because the process for adding each row to the dictionary is failing.

So the process is as follow: -

  1. Spreadsheet is loaded into a datatable, Customers
  2. Create the dictionary.
  3. For each row in the datatable get the row details (item.ColumnName & Value)
  4. Add to the dictionary

So until item 3 can complete I cannot say if the solution suggested will work.

The error is shown when I run debug on the Main.xaml file.

This has not been changed from the Legacy except that in the new version it actually shows the Column and Value details whereas in the Legacy it shows just the Row details

Again, nothing you are showing in your screenshot is related to the dictionary.

The code you show seems to be exclusively related to a datatable you are looping over.
There is an assign higher up where you instantiate the dictionary, but thats not causing an error.

Where do you think you are using the dictionary in the activity that is faulting?

Hi Jon,

So this section loops through the Datatable and it looks at the columnname, e.g. Type, and then gets the value, e.g. Change. This is then added to the dictionary as [Type,Change] then it loops over the same row for the next Column Name and then adds that after the [Type,Change]. Eventually once all the columns in the first row have been looped it will end up like this:-

[Type, Change] : [Customer Number, 3071234] : [MSISDN, 12345679] : [Slave MSISDN, ] : [TopLevelProduct, MBB B2C Finalized Version] : [SubTopLevel, ] : [Existing Abotype, MBB XGB] : [New Abotype, MBB XGB] : [FeeTemplate, PFT_000501 - 75 GB] : [DataTemplate, PDT_100013 - 75 GB] : [SubProduct1, ] : [Option1, ] : [SubProduct2 - Not Used, ] : [TopUp FeeTemplate, ] : [TopUp DataTemplate, ] : [BarringProducts, ] : [ExistingAPNTYPE, ] : [APNTYPE, Static IP Address] : [MultiSIM, ] : [PFC Check, ] : [Message, ]

Again, the activity you highlight doesnt show anything related to the dictionary from what I see,

You use the row variable, this is from a data table.
You use the item.ColumnName, this is from the datatable as you loop over the columns.
You use the value variable, which I cannot see the datatype, but its not the dictionary I think as in your screenshot the dictionary is called SpecificContent.

So again, I don’t think this related to the Dictionary, what makes you think it is?

You could replace the two activities “GetRowItem” and “polulate specific content” by a simple assing:

specificContent(item.ColumnName) = row.Item(item.ColumnName).ToString

Cheers

Hi there J0ska,

I changed it a bit and it seems to have worked.

So I now have the following: -

For Each row in Customer Datatable
For Each item
value = row(item.ColumnName).ToString
specificContent(item.ColumnName) = value.ToString

This then gives me

So now I need to convert a whole project and see how it works overall.

I think I will set this to resolved.

regards

William

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