Forum Academy Marketplace Showcase Pricing Features

Search for Users Based on Categories

Hopefully someone can help me solve what is simple to explain, but has been challenging for me to implement.

I have a datatype labeled Categories with over 50 “Category Types” that I manually entered.

When my users sign up, they use the MultiSelect dropdown and select several Categories to attribute to their profile.

I need to create a search that allows me to type in a Category Type and return a list of every User that matches the Category Type.

This has been driving me crazy, hopefully someone can PLEASE HELP!!!

1 Like

What’s the difference between a category and a category type?

Your search query should look like the following (assuming I understand the requirements):
Search for User where [User’s] Category Types contains Dropdown’s value.

1 Like

Category is the name of the datatype. Category type is the the name of the actual categories themselves.

That doesn’t work. That logic throws an error.

could you show a screenshot of your search and your user table?

I put an answer up last night… Looks like it’s gone!
@Scott 's answer should work, unless the Dropdown you have on the page is a multi select. In that case…

Assuming you are saving a list of Categories to the User you can set it up like:

Have a page with a Multi Select Dropdown, Dynamic Source of Categories, this will be the Categories you want to filter the Users by

Then have a Repeating Group of Users
Data Source: Do a Search For Users:filtered
On the Filter put an Advanced constraint of: This User’s Categories intersect with MultiDropdown’s value:count > 0

Essentially saying that when a User has at least 1 of the Dropwdowns Categories in their List, then they will show up

Although this is making a few assumptions of your data setup as well. Let us know how it goes and if it doesn’t work we will need more detail screenshots or access to the editor to help

1 Like

From what I understood, the multiselect dropdown was for the categories on the user. If it was also for filtering users, then @gf_wolfer 's solution would apply. My only fear is that you’ll be retrieving every user from the database to the user’s client, then filtering. This isn’t much of a problem if the number of user records is relatively small.

@gf_wolfer The forum had to be restored back to an earlier date, losing data from the previous 5 days.

2 Likes

Unfortunately to use the Advanced constraint you need to filter after the search returns all the data.

If you know of a way this type of search (common entries from two lists) could work without the :filter let me know! - I’ve seen you do some great work on here with Data structuring and referencing :thumbsup:

1 Like

@gf_wolfer

The user above your last post expressed concern about the amount of users being pulled from the database before filtering. However, location is also a factor for my search results. My Searches have a radius of 2, 5, and 10 miles. So I would think that only searching for Users with categories in that radius would be less intensive. Any thoughts?

I believe that is correct - If you put a filter/constraint on the Do a Search for Users part, it will help the :filtered step run quicker

1 Like

Good lord, thank you man! I did have to modify your suggestion a little to make it work.

My advanced filter went like this: This Users Categories contains Dropdowns value. Using “intersect” and “value:count >0” wouldnt check blue.

But @gf_wolfer, if I still have your ear, maybe you can provide guidance on one last thing. I have two types of user that appear in my Search. Verified and non Verified.

Generally, the users will be ranked based on distance from Current User. However, I want my Verified users to be ranked ahead of non Verified regardless of distance. Any more guidance you can offer? This is pretty much my last hurdle.

By the sounds of that Advanced filter, you are using a Single Dropdown (not a mutli-select). If this is the case you should be able to add this as a Constraint on the search and get rid of the filter (similar to Scott’s answer earlier). The intersect with strategy is only for two lists (not a list to a single value)

Constraint: Categories contains Dropdown’s value

Then in the Search (and in filtered) you can add Custom Sorting
Here you can define what fields to sort by, just make sure sort by verified is high up on the priority of sorting

1 Like

Smh… this is what happens when you try to do things at 4am. I tried that so many times and it wouldn’t work. I removed the filter, tried it using the constraints and now its functioning just fine :expressionless: Thank you for your additional advice, it’s been invaluable. I’ll implement now.

How do I define the priority of sorting. Just by the order I define it in the editor?

Right now I have sort by Verified Vendor, Descending= yes. So that means it should list V. Vendors when the status is “Yes” before Vendors where the status is “No”?

This topic was automatically closed after 70 days. New replies are no longer allowed.