Sorting through multiple items and getting multiple items

Hi Guys. Bit of a similar question to Getting the average of multiple Items.

I’m essentially searching up names. these names return users with varying follower counts (10 users), I take the user with the highest following count and discard the rest.

this is what my current workflow looks like.

The problem with this is I can only lookup 1 user at a time because of the sort and limit nodes. Is there any way I can “multi-thread” this.

here is an example of the data: https://paste.mozilla.org/0JRREpZO

from this I would like to return the username(s) of the user with the highest following count.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Trash

I don’t get the point. You are taking 10 users, and then filtering them to find the most followed one. So you will have only 1 user after the filtering. Where is the multi-threading here?

1 Like

No. sorry for not clarifying. I am searching up 1 user at a time. that returns 10 results, of those 10 results I pick the most followed user. The limitation is that I can only search 1 user at a time, if I search 10 users, and return 100 results, instead of getting 10 users (one for each search) with the biggest following, I will get the biggest user out of the 100.

I hope that makes sense.

You can search for multiple users and find the most followed for each of them. Just the filter will be more complex

any idea on how I can make this work? The code node is fine as well, I just dont know js.

Something like this may work.
In the example I have 3 regions that I’m interested in (Europe, Africa, Americas). Then I receive all regions and in the Code node a have a filter that looks for each of the interested regions and finds the country with highest population in that region.