Requirement:
Filter datatable where “AP Invoice Number”=Blank and “AR Invoice Number” not Blank and “Issue Type”=“Price Diff” or Blank and “Diff” column value “-1< and <1 ”,
My LNQ expression is below, however, I can not get the right value.
(From d In CSVDT.AsEnumerable
Let APInvoiceNum=d(“AP Invoice Number”).tostring.Trim().toUpper()
Where String.IsNullOrWhiteSpace(APInvoiceNum)
Where d(“AR Invoice Number”).tostring.Trim().toUpper()<>“”
Let ex=d(“Issue Type”).tostring.Trim().toUpper()
Where {“PRICE DIFF”}.Any (Function(x) x.Equals(ex) OrElse String.IsNullOrWhiteSpace(ex) And Convert.ToDouble(d(“Diff”).ToString) > Convert.ToDouble(-1) And (Convert.ToDouble(d(“Diff”).ToString)<Convert.ToDouble(1)))
Select r=d
).CopyToDataTable
where
“AP Invoice Number” = Blank
and
“AR Invoice Number” not Blank
and
“Issue Type”=“Price Diff” or Blank
and
“Diff” column value "-1 < and < 1 ",
(
From d In CSVDT.AsEnumerable
_
Let APInvoiceNum = d("AP Invoice Number").ToString.Trim().ToUpper()
Let ex = d("Issue Type").ToString.Trim().ToUpper()
Let diff = Convert.ToDouble(d("Diff").ToString)
_
Let c1 = String.IsNullOrEmpty(APInvoiceNum)
Let c2 = Not d("AR Invoice Number").ToString.Trim().ToUpper().Equals("")
Let c3 = ex.Equals("PRICE DIFF") Or String.IsNullOrEmpty(ex)
Let c4 = Math.Abs(diff) < 1
_
Where c1 And c2 And c3 And c4
_
Select r=d
).CopyToDataTable