Deleting multi-column filtering results

Hi,

I want to delete matching rows from datatable as a result of multi-column filtering with datafilter. But the results I filtered still appear in the datatable. How can I solve this problem?

image
image

Hi,

It might be better to use LINQ because of type matter. For now, can you try the following?

zteyit_dt = zteyit_dt.AsEnumerable.Where(Function(r) r(6).ToString<>Now.AddDays(-1).ToString("dd.MM.yyyy") OrElse r(7).ToString<>"07:30").CopyToDataTable

OR

 zteyit_dt = zteyit_dt.AsEnumerable.Where(Function(r) CDate(r(6).ToString)<>Now.AddDays(-1) OrElse r(7).ToString<>"07:30").CopyToDataTable

Regards,

I want to delete the rows from the datatable that match yesterday’s date in column 6 and values less than “7:30” in column 7. Does the expression you write delete the lines that match the conditions? When I try it still shows undeleted.

1 Like

Hi,

Is your source data Excel workbook? If so, can you share your workbook as a file? It’s no problem if dummy data.

Regards,

1 Like

You can use this file as an example. In the file here, I want to delete the rows that match yesterday’s date, that is, “08.09.2022” in the date column, and values that are less than “7:30” in the time column.
file1.xlsx (8.4 KB)

HI,

Sorry, I had a mistake for condition. Expression will be as the following. Can you try this?

dt = dt.AsEnumerable.Where(Function(r) CDate(r("C").ToString)<>Today.AddDays(-1) OrElse CDate(r("D").ToString).ToString("HH:mm")>"07:30").CopyToDataTable

Sample20220909-4.zip (10.7 KB)

Regards,

ı get this error.

Message: Conversion from string “A” to type ‘Date’ is not valid.

in my excel workbook A is the column which containing the hours. But the column type is the Custom.

Hi,

Do you mean you have an error you run the above attached sample?

Regards,

Hi @nilesay ,

Have you Enabled Add Headers Property in Read Range Activity ?

Hi,

yes, i changed the excel file and run

Regards

hi @supermanPunch ,

When i enable add headers i get error that ‘x has already belongs to datatable’.

@nilesay ,

Could you maybe provide us with Screenshots of the workflow and the Error ?

Hi,

It means your current worksheet differs from the above sample worksheet. For example there seems non-datetime type value in the target column.
So can you share your current worksheet or similar one?

Regards,