Problems to sort data with priority

Hello guys,

So here is my problem, I have 2 data outputs, one priority and one secondary less important.

My goal is to succeed in combining the two but if the number exceeds 10, I must keep the priority ones and “sacrifice” the secondary ones to continue

How can I do it ?

Below is an example of a workflow showing where I am stuck

Hey Clement,
I would use another data structure to solve this. So instead of using this


I would use something like this


This will allow you to use the Item Lists node to sort by priority and limit by 10. Here is an example workflow to illustrate.

Thank you for this solution!

The problem is that in the workflow the data are not as in the example in “sample data” but the departments are retrieved with the SET nodes.

Is this still possible as a solution?

Can you use the Set node to set priority=1 and priority=2 where you need it?

It seems to work for now, I will try special cases but I mark the solution as found, thanks again