I have a For Each Row in Datatable that’s looking for the first row that matches an IF condition, and adds it to another datatable (then breaks because I only need the first matching row). Looking to simplify all this.
Inside the For Each Row in Datatable the IF condition is:
(NOT CurrentRow(“CREATED_IN_NCINO”).ToString.ToUpper = “YES”) AndAlso DateDiff(DateInterval.Day,Now,DateTime.ParseExact(CurrentRow(“Maturity Date”).ToString,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture)) = 34
I got this far, where the expression didn’t give me any design errors, but when executing I got “String was not recognized as a valid datetime”
Assign loansDT = mainDT.Select(“CREATED_IN_NCINO != ‘YES’ AndAlso '” + DateDiff(DateInterval.Day,Now,DateTime.ParseExact(“Maturity Date”.ToString,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture)).ToString + “’ = ‘34’”).Take(1).CopyToDataTable