How to use a group loop and a recursive loop together?

Hello,

I am trying to make a group loop and a recursive loop working together but without success.

Below is what I would like to achieve.

In my table, I have a column containing 20'000 molecules (unique),  a second column containing 4 different scaffold numbers (this means 5'000 molecules per scaffold) and a third column containing the building blocks used on each scaffold to make the final molecules.

I would like to make a diverse selections of 100 compounds per scaffold (using RDKit Diversity Picker) but I do not want to use twice the same building blocks across the selections. Finally, I should get 400 molecules from 4 different scaffolds and always decorated with a unique building block.

I tried with 2 loops. A group loop; in order to group molecules per scaffold number. And since I need the recursive info (selected building blocks at each iteration), I tried to use the recursive loop node as well. Unfortunately, it does not work, it seems that I would need a combination of both loops (group loop with a recursive option) in one single loop and maybe that should work.

Any idea better idea?

Thank you.

Julien