Hi Everyone.
I want to filter and remove all rows which are not date format as picture.
How to do that?
Thanks in advance!
Hi Everyone.
I want to filter and remove all rows which are not date format as picture.
How to do that?
Thanks in advance!
Hi @Mr.H,
you can use invoke code to to run IsDate method on your value.
That will give you a boolean value which you can save into your data table to later filter and/or delete unnecessary rows.
Alternatively you can also try to cast your value into datetime format using
convert.ToDateTime(row(0))
If it’s not a date you’ll get an exception which you can handle and convert to a boolean value and later use to decide what to do with that row.
Hope that helps
BR,
Filip
@Mr.H
lets assume following:
Assign activity
left side: dtFiltered (DataType: DataTable)
right side:
(From d in yourOriginDataTableVar.AsEnumerable()
Where Regex.IsMatch(d(YourColNameOrIndex).toString.Trim,"\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2}")
Select d).CopyToDataTable
As an alternate we can base it also on a dateTime Parse Check
Assume following:
Assign activity
left side: dtFiltered (DataType: DataTable)
right side:
(From d in yourOriginDataTableVar.AsEnumerable()
Where DateTime.TryParseExact(d(YourColNameOrIndex).toString.Trim,"dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture,DateTimeStyles.None,nothing)
Select d).CopyToDataTable
Even more simple: Use Filter Data Table Activity. Keep all rows with “/” and “:”.
Hi Everyone.
Thanks you very much for your support!
Hi Bro @ppr
Sorry. I have another question related to your solution.
In your Code “(From d in yourOriginDataTableVar.AsEnumerable()
Where Regex.IsMatch(d(YourColNameOrIndex).toString.Trim,”\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}")
Select d).CopyToDataTable"… I want to remove all XX:XX:XX and keep only Date…
How to do that ?
Thanks you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.