How to filter according to length and build a new datatable

Hy

i m having a column Post area i need to Filter the column based on length of the string
Ex - Total number of digits length grater than 1 less than 3
25.06.2021_11.22.48_REC
how can i do it using a assign or filter datatable activity

Thank you

Hi @Tharusha_Fernando

dt1 - data table from read range
dt2 - empty data table

dt2 = dt1.asenumerable.where(function(row) row(“Post Area”).tostring.length>1 and row(“Post Area”).tostring.length<3).copytodatatable

dt2 will now have filtered data

Thanks

1 Like

@prasath_S if their s no rows it gives an error how to fix it

@Tharusha_Fernando Use an if Condition

dt1.asenumerable.where(function(row) row(“Post Area”).tostring.length>1 and row(“Post Area”).tostring.length<3).count > 0

in then part use assign activity

thanks

@prasath_S Thanks for your reply

do you know a another way to do the same thing without if activity because i m having around 20 checks to do
if i use if activities the sequances will became bigger

@Tharusha_Fernando use assign inside Try Catch activity

Thanks

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