Kalle77
(D.M)
August 22, 2024, 11:18am
1
I have data scraped a list of rankings, and I try to filter it to give me USA players with ranking less than 2700.
This above filter data works, it gives me the USA players if I try to print it out.
Then I try to filter the ranking, but then it just prints this:
This is the my table data:
If someone can help, i would really really much appreciate it!!
pradeep931
(Pradeep Bandharam)
August 22, 2024, 11:20am
2
Hi @Kalle77
Could you remove double quotes for “2700” value make it to 2700 and check
Kalle77
(D.M)
August 22, 2024, 11:26am
3
Thank you for helping me! But it didn’t fix it, still the same result in printing
pradeep931
(Pradeep Bandharam)
August 22, 2024, 11:29am
4
Change the “Column Name” to Column Index Value with 5
Raj_esh
(RM)
August 22, 2024, 11:30am
5
Output your data table after extraction and see the headers, pls check if it’s coming as column 1,2etc and another row of actual header name and then the values. If this is the case you might need to remove the first row
Hi @Kalle77
While Extracting the table,Try by capturing from row1 not from the headers.
And then Wile filtering Remove “” from 2700
Regards
@Kalle77
Check the condition is greaterthan equal to
Then
Print values data table to string use outputdatatable activity
The UiPath Documentation Portal - the home of all our valuable information. Find here everything you need to guide you in your automation journey in the UiPath ecosystem, from complex installation guides to quick tutorials, to practical business...
Remove " from value
Kalle77
(D.M)
August 22, 2024, 11:33am
8
Thank you! But it still prints the same.
Kalle77
(D.M)
August 22, 2024, 11:36am
9
This is what I get if I print text from the first filter data activity only. But when I try to do both filter datas and print, it gives me the one I add in the original post.
pradeep931
(Pradeep Bandharam)
August 22, 2024, 11:41am
10
In the input datatable you have passed already filtered datatable value “UsPlayers” there change it to ExtractDataTable and remove the double quotes for 2700
Varsha_PH
(Varsha PH)
August 22, 2024, 11:41am
11
Hi @Kalle77 ,
Try this Linq USPlayerRank= ExtractDataTable.AsEnumerable().Where(Function(row) row.Field(Of String)("Column-3") = "USA" AndAlso row.Field(Of Integer)("Column-4") < 2700).CopyToDataTable()
1 Like
Kalle77
(D.M)
August 22, 2024, 12:03pm
12
I dont understand. Do I put that to assign activity?
Varsha_PH
(Varsha PH)
August 22, 2024, 12:12pm
13
Hi @Kalle77 ,
To filter your data as needed, you’ll want to use two Assign activities:
Assign 1: USPlayerRank = ExtractDataTable.Clone()
Assign 2: USPlayerRank = ExtractDataTable.AsEnumerable().Where(Function(row)
row.Field(Of String)("Column-3") = "USA" AndAlso row.Field(Of
Integer)("Column-4") < 2700).CopyToDataTable()
Note : Provide the exact column names as your datatable
Raj_esh
(RM)
August 22, 2024, 12:20pm
14
Could you try getting the type of column 4 ?
Kalle77
(D.M)
August 22, 2024, 1:37pm
15
Thank you so much for your effort. Anyways, I got for using that a error: “Assign: Unable to cast object of type ‘System.String’ to type ‘System.Int32’.”
Raj_esh
(RM)
August 22, 2024, 1:40pm
16
Try this where rank is a variable of data type datatable.
The issue was because the extracted table data type is string , and you were comparing a string with an integer
Raj_esh
(RM)
August 22, 2024, 1:41pm
17
This is because the column 4 is of data type string.
Kalle77
(D.M)
August 22, 2024, 1:55pm
18
Thank you, I tried this but its still the same error. I dont understand. I used “ready” named variable instead of rank for some reason. It’s variable datatype is Datatable.
Raj_esh
(RM)
August 22, 2024, 1:58pm
19
Can you show the assign expression pls