Check three column value and update to another column through linq

@pankajj - For the time being I have assumed the Range is 10 sine you mentioned between 6/11 and 6/20 I have derived the below solution…

image

Read Range - Check the Preserve Format and Save the output as dt

Assign

dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({r("ID"),r("Task"),r("Date"),if(r("Task").ToString.Contains("Expires") AndAlso (Datetime.Parse(r("Date").ToString) >= Cdate(Now.tostring("M/dd/yyyy")) and Datetime.Parse(r("Date").ToString) <= Cdate(Now.AddDays(10).tostring("M/dd/yyyy")) AndAlso String.IsNullOrEmpty(r("Status").ToString)),"Present",r("Status")),r("P.no")},False)).CopyToDataTable

My Input(Purposely added Not Null in the status column to check the condition)

image

Output
image

Hope this helps…

Learned this code from @Yoichi :+1:

2 Likes