Hi guys,
Can I list dictionary elements without using for each activity? ( I want to print all elements using add data row ( using arrayRow property )
Hi guys,
Can I list dictionary elements without using for each activity? ( I want to print all elements using add data row ( using arrayRow property )
we do have some options
what is to achieve in general?
I want to print all persons that have same ages ( in one column )
33 : … , …
26 : … , … , …
31 : … , …
Hi @Shamsa_Abd ,
using below syntax to convert dictionary to datatable
dt.AsEnumerable().ToDictionary(Of DataRow, String, Object) (Function(row) row.Field(Of String)(0), Function(row) row.Field(Of Object)(1))
Regards,
Arivu
your case looks like grouping names on their ages
can your share some data with expected output description with us, Thanks
In this case you need to go back 1 step. You are using a sub-optimal collection for your data.
If you have a list of names, and a list of ages, don’t store them in a dictionary, but in a datatable.
Then you can filter, bundle, export etc a lot easier.
A dictionary is better used for data where each item has no relation to the other. Like a name, adress, age, shoesize for 1 person. If each data item has the same relation to other datafields, a datatable is to be used.
Also I don’t understand that restriction of not using for each. A lot of people state that on this forum and I rarely understand why. It feels like building table, but you’re not allowed to use a hammer… Use the tools that best fit and don’t restrict yourself.
I see, will check that thanks for your help. I thought that if could print dictionary data type items without for each because I have different data types for each column. I printed first column data from list, second column from list, third from dictionary , next from variable. Can I do that in one step by add data row activity? (or If you have easier sol rather than mine)
The output I needed is the following :
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.