Datatable query

dtoutput = (From d In dtinput.AsEnumerable()
Where not(string.isnullorempty(“name).tostring)
Group d By k=d(“Name”).toString.Trim Into grp = Group Let sum = grp.sum(function(x) cdbl(x(“Value”))) Let ra = New Object(){k,sum} Select r = Dtoutput.Rows.Add(ra)).CopyToDataTable()

This query will select the data which with same name and add the value for the particular name
And also ignore if name column has empty

If no values found ,
I need to add condition that its not throw error source contains no datat rows

@Demo_User

Add a if condition and instead of .CopyToDatatable use .count and check >0 and on then side use this assign

on the else side use dtOutput = dtinput.Clone

cheers

Hi @Demo_User ,

You could maybe check on the below post for handling the error :


can any one clear this error

@SaiSree_SUVERA

Thats not an error its a warning because you are using hardcoded filepaths…

And please create separate topic if you have any issue

cheers