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: -
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.
I have tried to implement as requested but I am seeing an issue prior to reaching the updated sequence . 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.
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.
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.
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: -
Spreadsheet is loaded into a datatable, Customers
Create the dictionary.
For each row in the datatable get the row details (item.ColumnName & Value)
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?
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:-
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?