Datatable group by using linq query

Hi,
I need help on linq query for sum of clinet column with group by clause on Account no and Department no.

Note: number of column are dynamic,

Test_excel.xlsx (9.9 KB)

Easy way: download “balaReva.DataTable.Activities” package.
Then using


Attach file: Main.xaml (6.0 KB)

3 Likes

@Shubh1801
it was nice question and will require a LINQ that occurs not every day in the daily work

Maybe I had misinterpretated your requirements so let me introduce following:

grafik

  • the yellow lines are to group as Account No, Department No. are the keys to look on
  • there can be many clients and it is dynamic (so e.g. a third client is to handle)
  • for each client the sums are to calculate: Client1=10, Client2=45
  • Grand Total has to sum up all clients sums and also needs to be dynamic e.g to Client3…

the other line from your excel can be computed seperated so I took it out from the task

I did a LINQ for it and the result is:
grafik

Find demo XAML here Shubh1801.xaml (7.0 KB)
Excel here Test_excel.xlsx (9.9 KB)

However I would suggest not to set on pure LINQ. A combination of LINQ and essential UiPath Activites or BalaRevas Activites let allow also to handle the dynamics, but let it stand much more easy to maintain.

1 Like

Thank you ,
We have moved to sql db approach as , there were more complex group by query need to performed.

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