How can I remove rows from a data table (excel) that doesn’t have 12 characters in the data cell? I’m trying to use the Filter Data Table activity and so far no luck with “Does Not contain” under operation and marked for a certain column with “xxxxxxxxxxxx” Thank you.
You should be able to read the cells you want to check using a “for each row” activity and then use a decision and a “is match” activity with the regex expression [1]{12}$. Then use a “remove data row” activity to remove the rows that don’t match your criteria.TwelveTest.xaml (10.7 KB)
You do not need to use regular expressions here. Instead, you can simply check the length of the string using: row("<column_name>").ToString.Length <> 12
Also, it’s not a good idea to delete items from a collection while you’re iterating through them. What you are suggesting would cause an error. Instead, you should probably create a new DataTable using the select method.
So I am getting errors on both solution. @dmccammond the process with the excel is giving an error and won’t go pass the first step. maybe because you built your data table and i’m using an excel?
@TomG I am getting an error on the last step. please see the picture.
I don’t have an activity in my example where the data table with the rows removed is rewritten to a physical file. you’d need to add this to see the rows removed on a physical file.