Filtering Data based on value in double format doesn't filter at all

I’ve generated table using “Data scraping” tool, Im trying now to filter the data table using value of WIID column < 500000, I’ve couldn’t get this code to work, I’ve tried:

A)
image
kept 0 rows

B)
image
kept 0 rows

C)


Exception

I also want to mention that this is data table generated by scrapping so values are probably strings? Correct me if im wrong

@zbigniew.lukowski

Is the column “WIID” is a String or an Integer ? If it’s a String use :point_down:

varWIID = Integer.Parse(“WIID”)

@zbigniew.lukowski Can you out put the data table which you are scraping and see what values you are getting. :slight_smile:

1 Like

@zbigniew.lukowski

Check below link :point_down:

Convert Strings to Integer from DataTable

1 Like

@zbigniew.lukowski use an assign statement and pass the below value to get the filtered output in a datatable.Here it is specified for WIID>500000.

Datatablevariable=ExtractDataTable.AsEnumerable.Where(function(x) Cint(x(“WIID”).ToString)>500000).Select(function(x) x).CopyToDataTable

2 Likes

Thank you for replying , unfortunately solution produce Compiler error:

@zbigniew.lukowski

Check below :point_down:

1 Like

The only solution working was looping through each row and removing them if “IF” condition was met:

but it’s really not efficent.

@zbigniew.lukowski

Use this instead :point_down:

ExtractDataTable = ExtractDataTable.select(“Convert([WIID],System.String) < 500000”).CopyToDatatable

Below xaml file :point_down:

StringToIntergerDT.zip (18.8 KB)

Let me know if it worked for you ? :slight_smile:

1 Like

Unfortunately not:

@zbigniew.lukowski

It works fine… :point_down:

Please share your workflow…

I was surprised by this fact as well but checked in scope and its table:

@zbigniew.lukowski

What do you do before that ? Check weither you convert your DataTable somehow…

I’ve moved the activity below or commented it,but that doesn’t change the outcome of activity:

guys remember that we are in UiPath forum and he is trying to learn it, we should avoid offering coding solutions to do things that dont require it… @zbigniew.lukowski that column is of string type, you cant use that operator to filter it… your solution is perfectly valid, removing the rows you dont want, BUT, what are you doing with the rows that have WIID < 500000? Because you can simply put an IF condition and use the rows you need and ignore the rest…

1 Like