Sum values group by columns

I’ve followed the above link only. but i’m getting the mentioned error.
The Activities ‘Aggregation’ and ‘Group By Aggregation’ works perfectly. Error occurs only in ‘Native Group Aggregation’ activity.

My scenario is, Group by ‘State’ column and aggregate the columns {“sum(Value1)”,“sum(Value2)”} then print the result.

Attached the sample .xlsx file and process flow .xaml files here. check it and assist me on this.

Test.xlsx (7.8 KB)

Hi,
Datatable coulmn data type should be in number data type like int,double. Except that, if you use it . You will get the Object reference not set…

Please check it.

Balamurugan.S

1 Like

Okay Thanks for the reply @balupad14, I’ll check it.

1 Like

Hi @balupad14,
I’ve changed the column datatype as ‘double’ as like you given in the Build data table activity. It works with your flow perfectly but still, the same error occurs for me.

Thanks in Advance.

1 Like

Hi @Senthilkumar55,

I saw the excel file. Yes you would get the errors. Because when you read the xl , the datatable column type is an object. definitely you will get an error. Very soon you will get solution from me for the datatype Problem. Finally Thank you very much using my package and activities. ´

Regards
Balamurugan…S

Hi Bala,

I am using Remove data row select to remove blank rows from my datatable.

My select condition is -
image

During execution, I am getting error as -

Please let me know, where I am going wrong.

1 Like

Your column should be surrounded in brackets since you have a space in the column name. Also, you need spaces between the column name, equal sign, and string you’re comparing to. Also, I’m guessing you’ll get a new error because you’re trying to compare a double to a string. You’d have to convert the column to string to do the comparison. A better way to do it might be to just use a .Where() and create a lambda function to sum it up instead of using .Select()

1 Like

HI @Zahid1,

As @Dave is right. So if you are not get clear point . Send me the Excel file. I will send you the sample to you.

Regards
Balamurugan.S

@balupad14

Getting this issue while performing Group By Aggregation please see the screen cast below.

image

image

Hello @Farhan

For group by “sum” from data table columns,you can use below select query,i think it’s help to you .

(From p In dt1.AsEnumerable() Group By x= New With { Key.a=p.Item(“Doc Id”),Key.b=p.Item(“Part Category”),Key.d=p.Item(“Tax Type”),Key.e=p.Item(“Tax %”)}
Into Grp = Group Select dt2.LoadDataRow (New Object() {grp(0)(0), grp(0)(1),grp(0)(2),grp(0)(3),String.join(“,”,(CStr(grp.Sum(Function(f) Convert.ToDouble(f(“Tax Amount”).ToString.Trim))) )),String.join(“,”,(CStr(grp.Sum(Function(f) Convert.ToDouble(f(“Total Value (Taxable Amount)”).ToString.Trim))) ))},False) ).CopyToDataTable

Regards
SUNIL PENDLI

1 Like