Filter integer from an excel

Hi Team,

I am using filter data table activity. Already read an excel file and saved the output in a ReadDT variable.

Now applying filter data table to filter age < 30 but it does not work as the tool identifies age as string.

Could any one explain how to filter age as someone suggested in the forum to use new data table but I want the value to be used in the same data table?

Also trying to filter using assign activity but copy to datatable property is not there. Could you please provide any suggestions on this?

image

Thanks,
Ula

Hi,
Please find attached excel i have used and tried to parse using both ways, i.e. filter data table activity which returns a data table
another is using “Select” method which returns array.word.xaml (10.6 KB) New.xlsx (8.4 KB)

Hi @Boopathi,

It’s because of your excel cell format. You should convert string value in int32 OR double, before comparing them with 30.

I’ll suugest you to try this, take one assign activity.

ReadDT = (ReadDT.AsEnumerable.Where(Function(r) Convert.ToDouble(r("ageColumn")) < 30).ToArray).CopyToDataTable

Note :- put age column name instead of “ageColumn”.
Now you’ll get ReadDT datatable which has age value less than 30.

1 Like

Hi @Samir, I am trying to understand the code and i have one more doubt.

In my code, copy to datatable property does not appear. Only copyto appears. Do I need to change anything?

Getting below error

Thanks,
Ula

@Boopathi,

I think it’s because of…may be, System.Data.DataSetExtensions Assembly is missing.
I’ll suggest you to import that assembly.
OR you can open your xaml file with notepad and add following assembly in it.

<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>

Save it, open xaml again, and rewrite the query.

Hi @samir. Thank you but there is no such namespace called system.data.datasetextensions to import in studio. I will go for second method and let you know.

Thanks,
Ula