How to covert the three datarows into one data Dictionary

i have a excel having more than 100 rows,usually,we will convert one data row into dictionary,but my requirement is
i want to convert the three data rows into one dictionary based of Column ‘name’,and start date and end date values.if name,startdate and end value is same for three rows,i need convert those 3 data rows into one dictionary.
can anyone help me on this,here is Excel.

image

1.) Create a dictionary variable MyDict of type Dictionary (Of String, Of List(Of String)). Set its default value to New Dictionary(Of String, String()).

2.) Add a For Each Row loop over your datatable. Let row be the row in the table.

3.) Add an assign activity in the For loop where the left value is row("Name").ToString, and the right value is {row("Start Date").ToString, String.Empty}.

4.) Add an assign activity in the For loop where the left value is row("Name").ToString, and the right value is {MyDict(row("Name").ToString), row("End Date").ToString}.

2 Likes

Thanks for the reply.

i am getting this error ,while giving the default value to dictionary.can you please help me.

It should be a dictionary with String keys and arrays of Strings, rather than Lists of strings.

yes,list of Strings.

still i am getting this error here.

i didn’t understand,what you are tying to do with this Assign,could you please explain to me once.

@Lakshmi_N From the Datatable what do you need as the key and what do you need as the values in the Dictionary?

my requirement is i need convert 3 data rows into one dictionary,after that i need to send this dictionary into Queues,all 3 rows i need to send as one item in the Queue,finally it will be all three rows as one Queue Item(only one data entry in Application),here key is headers,value will be the three column values.

if Name,Start Date,End date,all these 3 rows having same values(Condition),then i need create the Dictionary.

@Lakshmi_N Can you give a sample output as to what you need as the Key and the Value in the Dictionary, We can make our solution based on that and it will be Faster :sweat_smile:

Sample Output (Assuming):
Key | Value
Name | aaa
Start Date | 26/05/2020
End Date | 26/05/2021

Can you confirm is this the Dictionary that you expect or else please show the Output Dictionary that you need?

It should be a dictionary with String keys and arrays of Strings