Bug(?) - Cannot access datatable.AsEnumerable.Sum


Maybe Import is Missing

Thanks ppr. That options doesn’t show up on my list of imports. I tried installing the .net package “System.Data.DataSetExtensions” but get a “package installation failure” error in UiPath.

Very strange that it works with the workflow I copied/pasted from another project - it only throws errors if I try to edit it an any way (simply clicking in the value field causes the problem to arise).

Thanks bcorrea. I tried that too, and included the filter
Datatable.Compute(“Sum(Gross)”, “”).ToString

Which throws this error:
Assign: Invalid usage of aggregate function Sum() and Type: Object.


I am not sure If I got you, bu I hope you are not meaning installing with the dependency manager.

adding System.Data.DataSetExtensions should be added via this way (see my screenshot) but is not recognized. So editing the XAML direct will do it.

I had the same with this package and with Newtonsoft. The resolution hangs and sometimes it is resolved, sometimes not, regardless if its imported, but when it is imported in others xamls.

However I strongly to add it via XAML editing, due the library is very essential and helpfully.

Hi ppr,

Yes I tried with imports first, and “System.Data.DataSetExtensions” doesn’t show up there. So as an experiment I tried the packages dependency manager which gave the installation failure. I will try editing the .xaml directly, although last time I did that UiPath flagged a problem with the file. Probably pilot error will try again…

Yes it will not show up, as mentioned

adding the Assembly Reference manually in your xaml file: [image] Simply open the file in Notepad and create new line with this String: <AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>

Close Project, reopen project after

1 Like

OK I tried that and the problem persists… in fact now it shows up on the ones I copied/pasted as well (the ones that used to work) :-/ This is the error:

“Sum is not a member of System.Data.EnumerableRowCollection(Of System.Data.Datarow)”

Perfect one step forward.
Just give a small description on what you want to get, whats the input, statement …
So we will help you

A typical statement would look like this:
yourdatatablevar.AsEnumerable.Sum(Function (row) CInt(row(YourColNameOrIndex).toString.Trim))…

I have large datatables with a few cols like Gross, Net, and others. I want to get the total sum for specific columns without using a foreach loop.

That lambda is what I used previously and it worked. Now it only works if I copy/paste the workflow from before. If I try to edit it in any way, such as change the column name from “Gross” to “Net”, I get that error. I no longer see ‘Sum’ as a member of AsEnumerable.

This was what worked and works if I copy the assign activity without editing:
MyDatatable.AsEnumerable().Sum(Function(row) row.Field(Of Double)(“Net”))

in such a case dictate sum or delete .Sum and reinitiate intellisense
If datasetextenstions are imported (e.g edit XAML) even it hangs for some cases, but in general correct statements are executed


It doesn’t show up and it throws an error if I try to run it. With and without the imported (edited xaml) datasetextensions.

crosscheck datatype of io_invoices and its scope. Yes it sounds silly but things are sometimes strange. Hope that from assignment copy paste no confusion is caused, but also often happens

I know, but I’m 100% positive it’s datatable and I’m using io_invoices all over the (large) program. Also, it works with the assign activities I copied, it only complains when I try to edit them or simply click on them. So really looks like a bug :-/

Are you seeing that on community edition?

I am working with both editions (CE, Enterprise) i didnt encountered any better wotking on a particular one. As mentioned sometimes caches are lazy etc. But with restarts on the morning also this were not blocking. Nothing special to report or to feel it that it is blocking except heavy long LINQ statements did more often lose intellisense. But as mentioned, dictate even when it is not in the intellisense

OK, bug is showing for me in my project with both community and enterprise, but they are copies of the same files. I just did an experiment - started a brand new project, created datatable, and lo and behold - Sum is showing up as a member of AsEnumerable. Somehow my project got corrupted? This happened to me a couple of times before. I guess something happens during auto-updates. The solution was to go and recreate those projects from fresh, which is a bit of a nightmare for a project this size :-/

Anyway will mark as resolved I guess. Thank you for your help :slight_smile:

Ok happy Automation. lets formal close this topic with solution flag, so others supporters can easy recognize the status of this topic

Annddddd… it’s gone again (on the new project!). Sum is not a member of AsEnumerable again. I’m stumped.

every new project requires the manually edited XAML, any differences after done this including project close and reopen?

Sign Up Log In