How to sort repeating groups things by dates amount of votes

Hey everyone, I have built a repeating group for a thing called “products” I am trying to sort them buy date created and a custom data type, “Votes” using a dropdown, (I’d like newest to oldest and oldest to newest for both sort options) but am having trouble. I know I have to set the dropdown and then the repeating group, but I cant figure out how to set the drop down correctly so I havent added the repeating group search constraint.

Can some one please point me in the right direction?


Repeating Group:


Wireframe I am trying to accomplish:
Screenshot 2023-07-22 221819

Thank you in advanced!