Query to remove datatable

Step1: if datatable has more than one row
Step2: Check in any if the row Column A is empty and column B is empty or colmnn c = variable (holds a value)then remove the particular row

Input
Strvariable=400

Datatable
Column A columnB column c
1222525. 67. 400
400
Output
Column A columnB column c
1222525. 67. 400

Can you try this once
Datatable.AsEnumerable.where(Function(row) row.ItemArray.All(function(col) not string.IsNullOrEmpty(col.ToString))).CopyToDataTable

If value is equal 400 then only i need to remove that row

Try this:

(from s in dt_Input.AsEnumerable where Not String.IsNullOrWhiteSpace(s(0).tostring) AndAlso Not String.IsNullOrWhiteSpace(s(1).tostring) AndAlso Not s(2).tostring.Equals(Strvariable) Select s).CopyToDatatable

Hi @Demo_User ,

Could you maybe check the condition mentioned and the Expected Output that you have provided, I believe there is a confusion as the condition does not match the output.

Inputs


Output

Here input and output

@Demo_User ,

Check if the below Expression will be able to get you the right output :

(From r in DT.AsEnumerable where Not(String.IsNullOrWhiteSpace(r("Column1").tostring) AndAlso String.IsNullOrWhiteSpace(r("Column2").tostring)) orElse Not r("Column3").tostring.Equals(Strvariable) Select r).CopyToDatatable

Workflow Screenshot :

image

can you try this once
dt.AsEnumerable.Where(Function(a) Not (a(0).ToString.Equals(“”) AndAlso a(1).ToString.Equals(“”)) OrElse Not a(2).ToString.Equals(“400”)).CopyToDataTable
replace your variable at “400”
thanks and regards