Remove data row if the value cannot be find in an array

I have a datable which contains three columns, Column one is a list of date in which, I need to check it’s contents if it matches with all of the items in an array. For example

Array Contains {1,2,3}
DataTable Column One Contains{1,2,3,4,5,6}

I want to filter out the Datatable where to row with value {5,6} is not present. Both the array and data column items are dynamic.

Hi @RGT ,

We would require to know How the formats of Date are appearing in both the Array and in the Datatable.

This is required to Convert it to a Proper DateTime value and then Compare between the Array and Datatable Column.

For Inspecting the Date Formats, you could Check with the Write Line or use Debug.

Or you could simply provide us with the Sample Input file and the Dates present in the Array.

I always convert them first to Short Date String. They all start from string so I do

Convert.toDateTime(var).ToShortDateString

@RGT , Could you try the below Expression :

arrayRow = DT.AsEnumerable.Where(Function(x)Not(dateArray.Any(Function(y)CDate(y)=CDate(x("YourDateColumn").ToString)))).ToArray

here arrayRow is a variable of Type Array of DataRow, and DT is the Input Datatable, dateArray is a variable of Type Array of String.

Using arrayRow we can Check if it consists any rows and then convert it to Datatable.
Following Post Explains the conversion :

let us know more details on the datatable. Just share the immediate panel result for:
YourDataTableVar

Have a look here on how to do: