How do I filter data from a csv file?

Hello,

I need some help with filtering a csv file. I have a csv file that contains some data, and I want to filter it based on the following criteria:

The value in the “Suspicion” column should be greater than 4.

However, when I try to do that, I get only an empty data table as a result. I am not sure what I am doing wrong or how to fix it. Can anyone help me with this problem?

Thank you in advance.

Filter.zip (149.7 KB)

1 Like

Instead of filter datatavle try to use a assign activity like this as I could see ur filter datatable is not filtering records

filteted_dt = SuspicionList_dt.AsEnumerable().Where(Function(a) Convert.Toint32(a(“Suspicion”).ToString.Trim)>4).CopyToDatatable()

It basically because the column Suspicion is of type string but we are trying to compare a numerical Value as >4

That’s why filter datatable is not working

So u can try with above linq query in assign activity which also does the same but here we are converting to integer before filtering

Hope this helps and clarifies

Cheers @anlinalbert

1 Like

Hi,

Can you try the following sample?

 arrDr=SuspicionList_dt.AsEnumerable().Where(r=>Int32.Parse(r["Suspicion"].ToString())>4).ToArray()

FilterV2.zip (3.5 KB)

Regards,

1 Like

It worked. Thank you so much for your help. I really appreciate it. :smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.