Filtering Data Table

So I am attempting to use Filter Data Table to remove all rows from a data table in which the value in a certain column is greater than some threshold. However, I cannot seem to get this figured out. I am having trouble accessing the correct column even. I have tried using 0 based and regular indexing, as well as using the name of the column. Please help

Hi @jpreziuso,
Can you please attach a screenshot so that we can understand better…

Cheers.
Vashisht.

I actually figured out how to filter the table. But another question, is it possible to save all the rows that you are filtering out into another data table?

Yes.

If you are using filter data table activity, you have an option to enter the output data table in the same activity.

If you are using DataTable.Select then add .CopyToDataTable at the end of the expression.

Regards,
Karthik Byggari

Yes @jpreziuso,

1.You can use the filter data table activity present in the activities panel.

2.You can set the condition in that and keep the output data table.

3.The output data table contains the filtered data.

Any doubts let me know.

Cheers.
Vashisht.

Slightly confused I guess. I am removing a number of rows from a data table. I want to keep the resulting rows as one data table and the rows I removed as another separate data table. This is possible with Filter Data Table?

1 Like

yah this is abosolutely possible
if we want to filter a column with a numerical value like greater than or lesser than a value, but that column being a string type, then we wont be able to filter that with FILTER DATATABLE ACTIVITY
unless the column in datatable is a int32 we wont be able to use > or < with a numerical value for a column as a condition inside the filter wizard

so for this
we can use SELECT METHOD LIKE THIS
datatable1 = datatable.Select("Convert([yourcolumnname],ToInt32) > β€˜123’ ").CopyToDatable()
whre datatable1 is varaible of type new system.data.datatable()

Cheers @jpreziuso

1 Like

Does doing it this way remove the rows from the original data table? Or just copy them from the original to a new data table?

1 Like

if we want to do this
we can name the same datatable on either side of assign activity like this
datatable = datatable.Select("Convert([yourcolumnname],ToInt32) > β€˜123’ ").CopyToDatable()

or

if we want to create a new datatable with filtered datatable
then we need to mention different datatable name
datatable1 = datatable.Select("Convert([yourcolumnname],ToInt32) > β€˜123’ ").CopyToDatable()

where datatable1 is varaible of type new system.data.datatable()

Cheers @jpreziuso

1 Like

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