Sort Datatable into a specified column

Hi All, would like to know if it’s possible to sort this data table and output its total?


Desired output:
If the status or exception does not exist, values should be at 0

Thanks & Regards,

@JLASyntax404 yeah its possible with group by count

Yes. you should use assign activity.

In the left hand side of assign acitivity you should use dt2, in the right hand side you should use Linq.

Linq example:

(From row in dt1.AsEnumerable
Group row by sc = row(“STORE CODE”).ToString()
Into grp = Group
Let total= grp.sum(Function (x) Convert.ToDouble(x(“CREDIT”).ToString().Replace(“$”,“”).Trim()))
Let result = New-Object() {grp(0)(“STORE CODE”),total}
Select dt2.rows.add(result)).CopyToDataTable

Have a look at the “Create pivot table” activity.

1 Like

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