How to check if certain column in a datatable contains a certain value

Hello all,

I am trying to make a condition for IF.
I have a datatable of holidays this year. I want the condition to check if the column of dates contains todays date[DateAndTime.now.ToString(“yyyy-MM-dd”)].

Any idea what the condition I can write be, OR is there other activities that I need to get involved?

Hi ,

The Lookup value can be used for it . If the Today date is available in the Specified column then index value will return else if rowIndex<0 then not present.

@dvn
in general we can do it with a linq within an assign:

Assign activity
left side: isPresent - Datatype Boolean
right side:

YourDataTableVar.AsEnumerable.Any(Function ( r ) r(YourColNameOrIndex).toString.Contains(now.ToString(“yyyy-MM-dd")))

it will return true if in any row the date is contained in the value of the referenced column

1 Like