Question about Splitting Dynamic Data Table

Hi UiPath,

On my situation I needed to split a dynamic Data Table based on the distinct values of a column.

Example:

Billing Document Serial Number
ABC1234 SH00123151
ABC1234 SH131A8911
ABC5678 SH131A8911
ABC5678 SH1231AAAA

As you can see in the column “Billing Document” there are 2 distinct values. These are ABC1234 and ABC5678.

My question is how can I create dynamic data table for each distinct value? These Distinct values might change

Hope my question make sense.

Advance Thanks!

Assign Activity
TableList | DataType: List(Of DataTable) =

(From d in yourDataTablevar.AsEnumerable
Group d by k=d("Billing Document").toString.Trim into grp=Group
Select t = grp.CopyToDataTable).ToList

then loop over TableList and process the split DataTables as needed

Hi @alvin.c.apostol26

Try this

dt.AsEnumerable.GroupBy(Function (x) x("Billing Document").ToString.Trim).Select(Function (x) x.CopyToDataTable).ToList

Regards,

@alvin.c.apostol26
Also have a look here:

first part describes a Non-Linq approach

1 Like

@alvin.c.apostol26

image

Regards,

1 Like

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