My goal is to parse the excel file (read range) and then pull rows in which a certain column’s contents meet specific criteria. This column contains zip codes with multiple different formats. I would like to catch any obviously incorrect numbers based on length and last four digits.
I’m assuming I need to use Assign on my new datatable, however I am not sure how to set the criteria.
Create Array NameAs arrZipcode & set Value as {“0001”,“0002”) untill 0009
use below code
Use Zipcode col Name in "ZipColName Field
ContractTable_ExcelVariable.AsEnumerable().Where(Function(x) x(“ZipColName”).ToString.trim.Count>=9 And Not arrZipcode.Contains(x(“ZipColName”).ToString.trim.Substring(x(“ZipColName”).ToString.trim.Count-4))).CopyToDataTable
Just create a variable in the variables pane and the type should be array of whatever type you want, then initialize the variable as new array(length you want){}@nyabbas
So this got a bit more complex. Once I extract the original downloaded file, it is in csv format. So I used “Read CSV” and saved the data table as a variable. Now, I may be misunderstanding the above advice, but my next step was to use assign with the new data table like so:
The error states that the variable name, i.e., the table you have is not recognized . May be it is not declared globally. Try changing it as a global variable and then check @nyabbas
Rather than extracting certain rows based on criteria, could I simply highlight the rows within the excel file based on criteria? And then save that file?
The problem is Empty zip code … for that use below code …
tes.AsEnumerable().Where(Function(x) if(String.IsNullOrWhiteSpace(x(“ZipColName”).tostring),false,x(“ZipColName”).tostring.trim.Count>=9 And Not arrZipCode.Contains(x(“ZipColName”).ToString.trim.Substring(x(“ZipColName”).ToString.trim.Count-4)))).CopyToDataTable
The problem is Empty zip code … for that use below code …
tes.AsEnumerable().Where(Function(x) if(String.IsNullOrWhiteSpace(x(“ZipColName”).tostring),false,x(“ZipColName”).tostring.trim.Count>=9 And Not arrZipCode.Contains(x(“ZipColName”).ToString.trim.Substring(x(“ZipColName”).ToString.trim.Count-4)))).CopyToDataTable