Hi Alexandre,
Thanks for the clarification. In that case, since the ranking is determined in the data model then the solution I have described below still stands.
Since it is not possible to iterate through the rows of a data source result set with the standard functionality, the approach I have described stores the TEAMID and POS values in a Collection (which is like an array) and then applies a sort on POS to reproduce the ranking, after which you can address each row individually to retrieve the TEAMID in rank order.
Regards,
Mustafa.