Error with linq expression to filter table

hello community

I have a problem with a linq expression, I already use the first expression and everything was going fine, I added another rule and now it’s going wrong, that is, the table returns empty even though there are values ​​corresponding to the rule.

This was the expression I used and it worked:

dtOrdenada.AsEnumerable().Where(Function(row) DateTime.ParseExact(row(3).ToString(), “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Today.AddDays(15 ) AndAlso row(0).ToString().Contains(“CAR_DUPL”) AndAlso row(1).ToString().Contains(“Invoice”) AndAlso Convert.ToDouble(row(5)) > dbl_valorNCMB).CopyToDataTable()

this is what I’m trying to implement and now it’s going wrong: (what’s in bold is what I had to add)

Note: it is the same table, with the same data types

dtOrdenada.AsEnumerable().Where(Function(row) DateTime.ParseExact(row(3).ToString(), “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Today.AddDays(15 )AndAlso
DateTime.ParseExact(row(2).ToString(), “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture) >= DateTime.Today.AddDays(5) AndAlso
row(0).ToString().Contains(“CAR_DUPL”) AndAlso
row(1).ToString().Contains(“Invoice”) AndAlso
Convert.ToDouble(row(5)) > dbl_valorNCMB
).CopyToDataTable()

Could you help me??

@amanda.gondim

What you can try is use your earlier working linq which returns a data table dt_temp now on dt-temp apply just the updated condition of row(2) and check if you get any results

Hi @amanda.gondim

Your Linq expression is totally perfect.

But you are not getting the expected results right…?

Could you please give a brief view of what conditions do you want to check. Then we will try to validate your expression.