Filter remove row have numbers

Hi all,

I use Lookup Range activity (because dynamic column) to find Sales Contract No then get the date 21-Dec-23.
I just know to use a filter to remove row contains: Sunsco but have some more row numbers. how to delete all rows under Sales Contract No rows to get the date row 21-Dec-23 ?

@anh.nguyen

May be after finding the sales contract no row…use a loop and loop through each row and use a matches activity inside till you get the match count as 1 and then that is the required date

If the date when you reqd this is also in same format then use regex.match(currentrow(0).ToString,“\d{2}-[A-Za-z]{3}-\d{2}”).Count>0 …on then side use .value to get the date or directly currentrow(0).Tostring and use break to stop the loop

Cheers

1 Like

Can you see my workflow and explain more. Or can keep only the row have Date ?
DLV010 - Copy (1).xaml (20.5 KB)

@anh.nguyen

Please try this

DLV010 - Copy (1).xaml (24.9 KB)

cheers

It error, I send my excel and date want get
SSC-2023-112 TEXAS 336949-08 - Copy.xls (41.5 KB)
image

Find Matching Patterns: Column ‘ColumnName’ does not belong to table .

@anh.nguyen

You have to change the column name to the required columnname or index that you would search in…

Please check the piece of code I added and amend it as per the data

Cheers

1 Like

I change index column: 9 and get error:

Write Line: Conversion from string “PO NO: SUN201618/336949 -08” to type ‘Date’ is not valid.

@anh.nguyen

Thats an error on your write line where you are converting string to date

Cheers

I assign as below and can get date format but how can get output value with no need write range ?

Use output datatable but have column header
image

dt=dt.AsEnumerable.Where(Function(w) DateTime.TryParseExact(w(“ColumnName”).ToString.Trim,“MM/dd/yyyy hh:mm:ss”,Nothing,Nothing,Nothing)).CopyToDataTable

Hi @anh.nguyen ,

You can use the filter data table to keep only the required columns in the output.

Regards,

I use assign can get only date format and I want get out this value no need write range active ?. I try to use Output table but it have column header.

@anh.nguyen

Use dt.Rows(0)(8).ToString

cheers

1 Like

@anh.nguyen Try the below syntax and assign to string variable
RequiredDate = dt.AsEnumerable.Where(Function(w) DateTime.TryParseExact(w(“ColumnName”).ToString.Trim,“MM/dd/yyyy hh:mm:ss”,Nothing,Nothing,Nothing)).Select(Function(x) x(“ColumnName”).ToString).SingleOrDefault()
Hope this helps.