How to use expression groupBy to Grouping Data in UiPath by using Dictionary Datatype?

dt.AsEnumerable.GroupBy(Function(r) Tuple.Create(r("Effective Date").ToString, r("Location").ToString,
r("Change Percent").ToString)).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable())

This code work!

If i would like to groupBy more than two columns then i write it like this why not working?

for more details
image

Any suggestion? Thank you very much if you reply by coding.

HI @lovepong66

You can try with LINQ expression

(From d In dt.AsEnumerable
Group d By 
k=d("Effective Date").toString.Trim,
k2=d("Change Percent").toString.Trim,
k3=d("Out of stock date/Reset Date").toString.Trim,
k4=d("Loction").toString.Trim 
Into grp = Group
Let ra = New Object(){grp.First()(0),k,grp.First()(2),k2,grp.First()(4),grp.First()(5),k3,grp.First()(7),k4,grp.First()(9)}
Select r = dtClone.Rows.Add(ra)).CopyToDataTable

Regards
Gokul

Hi,

Because you need to use Tuple<T1,T2,T3> type as the following.

image

It should be Dictionary<Tuple<String,String,String>,DataTable> type.

Regards,