Error when I try to filter a Datatable

Hi, I am trying to filter a dt. The column has datetime values like “03/20/2021 00:00:00” in string format. How can I filter by Today date?

My VB code: “(From n In DataTable.Select(”[Column3] = ‘" & PurchDoc & "’ AND [ResponseFirstLetter] = ‘True’ AND [SendingDateSecondLetter] = ‘’ OR [Column3] = ‘" & PurchDoc & "’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] <= #" & Today.ToString & “# OR [Column3] = '” & PurchDoc & “’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] = ‘’ AND [Column23] <= #” & Today.ToString & "# “)).CopyToDataTable”

But I am getting a Error: If: Cannot perform ‘=’ operation on System.DateTime and System.String.

Hi @111564 !
Welcome to UiPath Community :grin:
Well I wonder if you should try something like Today.ToString("MM/dd/yyyy HH:mm:ss")
Or maybe something like CDate(Today.tostring)
Did not try though these possibilities, but let us know

Hi Hiba_B,
I try to use this:

  1. If: (From n In DataTable.Select(“[Column3] = '” & PurchDoc & “’ AND [ResponseFirstLetter] = ‘True’ AND [SendingDateSecondLetter] = ‘’ OR [Column3] = '” & PurchDoc & “’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] <= #” & Today.ToString(“MM/dd/yyyy HH:mm:ss”) & “# OR [Column3] = '” & PurchDoc & “’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] = ‘’ AND [Column23] <= #” & Today.ToString(“MM/dd/yyyy HH:mm:ss”) & "# ")).Count > 0
  2. If: (From n In DataTable.Select(“[Column3] = '” & PurchDoc & “’ AND [ResponseFirstLetter] = ‘True’ AND [SendingDateSecondLetter] = ‘’ OR [Column3] = '” & PurchDoc & “’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] <= #” & CDate(Today).ToString(“MM/dd/yyyy HH:mm:ss”) & “# OR [Column3] = '” & PurchDoc & “’ AND [SendingDateSecondLetter] = ‘’ AND [Column24] = ‘’ AND [Column23] <= #” & CDate(Today).ToString(“MM/dd/yyyy HH:mm:ss”) & "# ")).Count > 0

But I just keep getting this error: If: Cannot perform ‘=’ operation on System.DateTime and System.String.