Sort based on a linked entities field

OK, I have a user directory, and I have different filtering. I’ve also created a way for users to have skills that can be ranked.

I created a new Data Type called “Verified_skill”, and in this is a field named “Person” linked back to the user, and “Skill” which is linked back to Option Set Category. I also have an “Order” which is a number that pulls from the Option Set “Skill Level” during the creation of the “Verified_skill”.

Basically Skill Level option set is things like Entry, Junior, Mid, Senior, and it has attributes Order 1, 2, 3, 4.

In the directory, someone can select a skill and it will filter all the people who have that skill entered, but if they check the “Verified” this is when I have a condition on the repeating group and changed the Data source to look for verified users. I had to do this by adding to the user Data type fields for both Verified_categories which pulls the Verified Skill’s category to add to the users data type. I also have one “Verified_Skills” to attach all the verified skills entries to the user.

As you can see on the condition data source it is looking to the “Verified_categories” to filter more quickly.

This is all working, but the only thing I wish I could get working is to be able to sort based on the Verified Skills’s Order number field. I’ve tried many ways and it does not work. The challenge is one user might have many verified skills, so when the user selected a skill in the filter it looks for users that has that verified category. I would like it to then look at that user, do some kind of a search for a verifies skill that is the same as the selected filter category, and then sort all the results based off the attached verified users skill order.

I want those with higher skill levels to appear first. Sorry, I know this might be confusing, but please let me know any questions you might have. Thank you.

@keith Would Floppy be able to do this?

Yeah, @tylerboodman, if you have some list and then you have some other numerical list by which you want to sort the original list, one could use the “Count Fields/Sort” action. I didn’t read in detail what the OP is trying to do but in general that’s what that action can do.

This can also be done with List Shifter’s SORT action, though Floppy is easier if one is in fact counting the number of items in some field. In both cases, you can sort one list (of arbitrary type) by some other numeric list.

Some pointers:

1 Like

Hello Keith,

Sorry I was not able to follow what you were saying. I tried watching one of your videos, but a lot of the terminology you use is over my head. It sounds like you’re suggesting using a plugin to do this? Is there a way to do this without a plugin?

It is an age-old issue in Bubble where you can’t sort by a calculated value unless you use Keith’s ListShifter or Floppy plugin.

The only other thing I can think of is your repeating group could have the type Verified Skill (sorted by Order #) then you would need a repeating group inside the cell searching for users of that cell’s Verified Skill.

Thank you. I was thinking of something way out there that I’m sure would slow the system down.

Since users is the main source on our directory I could add a field to users called “verified_skill_order”, and when someone selects a category, and then clicks the verified check mark it would setoff a workflow that basically looks to see any user with a verified skill of the skill in the dropbox and update the user record new field with the order number and then sort by that. It might be such a slow process it would take awhile for it to go through all the users to update that field each time.

I thought I could outsmart it, and set it so when the the verified is checked it would change the data source, and then sort that, but as soon as you group it the sorting does not work.

This might work if you could change the Data Type of a RG with a condition.

I could also have two RG(one with data type Users and the other Verified Skills) and have one disappear and the other appear when Verified is checked, but then I feel like I would lose the ability to filter based on the other filters which are linked to the user.

I think my first comment didn’t have the right names but try a repeating group with the option set Skill Level (sorted by Order) then inside is your exact same repeating group searching for Verified_Skills but with the extra constraint that Skill Level = Current cell's Skill Level. So your existing constraints with all the dropdown will still work on each repeating group

You can even have headers inside each Skill Level cell with it’s display so they are visually grouped by Entry, Junior, etc.

Then like you say if Verified is checked then hide your first repeating group and show this new one.

OK, so this way would still require having two separate repeating groups. I was trying to find a way to use the same one, since the repeating group has a lot of conditions, and did not want to have to maintain it on two different repeating groups. Still, a nice touch to be able to have them in Skill categories, so it seems the only way to do this would be to have them separate and hide/show them when the verified button is pressed. Thank you