Filtering Data

Guys so i have some employee data with name and id number employee. The format of id number employee is different for each employee. e.g

  1. 0000123 Kelvin
  2. 0001122 John
  3. 0011223 Doe
  4. 0008950 Henry

In the end of the day, i only want the data with id number start with 1 after 0, is it possible?

@Kelvin1


Use condition inside filter datatable activity

Hi @sangeethaneelavannan1 is it ok if the id employee have id like this “0001” or like this “001” ?

@kelvin
if id is like this
“0001” or like this “001” ? then it will not come after the filter activity

Hi @Kelvin1

How about this LINQ expression

Dt.AsEnumerable().Where(Function(x) System.Text.RegularExpressions.Regex.IsMatch(x("Id").ToString.Trim,"^0+1\d*")).CopyToDataTable

image

Regards
Gokul

@sangeethaneelavannan1 the thing that i want, no matter how much “0” before “1”. If the id employee have “1” after the “0” i want that data.

Hi @Gokul001 ill try it later, could u please explain about this one “^0+1\d*” ? what it does mean?

@ kelvin


This will work

^ → Starting of the string and start with N number of 0 so i added + after the Zero.

1\d* → After the 0 it will check for One and get all the number after the one.

Regards
Gokul

hi @sangeethaneelavannan1 unfortunately i dont think its gonna work. because the data that i gave is just a sample, there is possibility the id employee like this 0008219

image

@Gokul001 Okay im gonna try it later man, thanks for the answer

@Kelvin1 ,

Hey while taking each row value, convert it into integer using Cint() ,so that all the 0 from the starting will be dissapered, so then you can if the value starts with 1 ?

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