How to get max value from datatable having string column datatype

I have statement data in datatable using screen scraping all column in string data type, I want to get max debit entry from debit column with remaining balance from bal. Column.

Hello ,

you can use linq using this format

var maxValue = table.Max(x => x.Status)
var result = table.First(x => x.Status == maxValue);

1 Like

Hi @Anil_Potekar

Please have a look at the below workflow
Main.xaml (15.2 KB)

1 Like

Hi @Anil_Potekar ,
you can use below query to get max value of the column
int MaxValue=Convert.ToInt32(dt.AsEnumerable().Max(Function(row) Convert.ToInt32(row("Column2"))))

Regards,
Arivu

3 Likes

I’m facing this error
Max is not a member of system.data.Enumerablerowcollextion(of system.data.datarow)

It’s shows error
Assign: input string was not in a correct format

Hi @Anil_Potekar ,

I checked its working fine for me
try below one
int maxval = Convert.ToInt32(dt.Compute("max([ColumnNmae])", string.Empty))

Regards,
Arivu

please refer below post to fix the issue

Regards,
Arivu

Facing this error
Assign invalid usage of aggregate function Max ()and type: object