DataTable Column Sum not working after updating dependecies

Hi all,

Ran into a bit of a problem and i can’t quite figure it out.

Was using assign to perform select and sum on a datatable to extract a value i needed. Like this:

ExtractedValue = MyDataTable.AsEnumerable().Sum(Function(x) If(IsNumeric(x("MyColumn").ToString.Trim),CDbl(x("My Column").ToString.Trim),0)).ToString

The project was created sometime in 2019. Worked perfectly until today, when i decided to update dependencies, after which, i am getting the following error message for this assign activity:

" Compiler error(s) encountered processing expression …(the above expression)…Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class."

Does anyone have any idea what is causing this?
Thank you in advance for your answers and have a good one! :slight_smile:

@Serban It might be because of IsNumeric method that you have used .

Replace the Condition with this and check :
x(“MyColumn”).ToString.Trim.IsNumeric

1 Like

hi @supermanPunch, thank you for your answer.
i have tried your suggestion and i’m getting error message: ‘IsNumeric’ is not a member of ‘String’ for this syntax

@Serban That is Odd. I have faced the same issue before as well. I don’t exactly know why UiPath treats it different sometimes :sweat_smile:

Although another method would be to use :
Double.TryParse(x(“MyColumn”).ToString.Trim,Nothing)

If you’re sure that the values are only Integers you can use the below :
Integer.TryParse(x(“MyColumn”).ToString.Trim,Nothing)

1 Like

Thought about trying Double.TryParse and forgot, thanks for reminding me. Yeah, i don’t know either. The only thing that changed between yesterday and today was that i updated the dependencies. Going to try downgrading or reverting to a previous version of the project.

1 Like