Filtering DT row if 3rd digit has a specific value

Hello I have a data table I am trying to filter based on a digit in the third digit location. There is only one column so I just need to point to the third digit and if it matches export the row. I figured using the filter data table may be faster than a for each loop since the file has a lot of rows. Is it possible to do it this way ?
Ex:
col(0)
42268594674 xxxxxxxx yyyyyyyyyy
34768473245 xxxxxxxx yyyyyyyyyy
19287645689 xxxxxxxx yyyyyyyyyy

I want the filter data table to keep the entire row data for 42268594674 and 19287645689 but leave the other data row.
:filter output into new DT
42268594674 xxxxxxxx yyyyyyyyyy
19287645689 xxxxxxxx yyyyyyyyyy

@jarrettd88 Yes, It is Possible, Use Filter Datatable Activity with Contains Operation.
Something Like this
Capture

There are over 500 rows I cannot add each manually I want to check the third digit specifically and filter based on that value.

So if you’re only looking for records where the 3rd digit is 2, use this in your if condition where row is the row item.

row(0).ToString(2) = "2".

the logic step is working correctly (thanks ! ). I am having issues getting the data row exported. The preferred method would be to add a row to the data table and export the entire thing at the end of the for each row.
Here are my current steps, still trying to figure out how to export the line.

First, assign a new datatable set to DT1.Clone before you start iteration in your For Each Row loop. Then use the Add Row activity and pass this to the ArrayRow parameter: row.ItemArray.

1 Like

@jarrettd88 Can you try using this Query :
in An Assign Activity Use this :
DT = DT.AsEnumerable.Where(Function(x)x(0).ToString(2).ToString.Equals(β€œ2”)).CopyToDataTable

This worked, Thanks for your help and quick responses !!!

1 Like

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