Forum Academy Marketplace Showcase Pricing Features

Multilevel search (Solved)

Hi folks, I’m creating a search to match dog owners with other dog owners to exchange pet sitting. I’m not able to achieve a specific constraint - I believe this is a ‘multilevel search’ issue.

Data structure for this issue:

User

  • name
  • email
  • etc…
  • dog (list of data type Dog)

Dog

  • name
  • size (text, 1 of 4 possible options: toy, small, medium, large)
  • size that the dog gets along with (list of texts, same 4 possible options)

For the sake of simplicity we can assume that every user just has one dog.

I have a search that shows a repeating group of users where one of the filters is:
show me users whose dog is one of the sizes that my dog get along with.

Struggling with this because the ‘do a search for’ call does not allow you to go one layer down into the data. See attached screenshot. Any advice is greatly appreciated. Thanks!

@NigelG - can you help?

(Sorry I’m being a bit shameless and just commenting you in since you helped me with another somewhat related issue. Thanks in advance!)

So is the Dogs field a number or text?

If it’s a number you can do a numeric comparison against the current user’s dog to filter out dogs that are compatible. If it’s a text - ie large, medium, small then you’d have to put some logical comparison in place. I’d add a numeric field next to the text description in your table so that you can use it for this purpose.

Its a text. However the issue is more that do a search for does not let you dig further down. In this case, since I’m doing a search for users, it does not let me add constraints to properties of the users dog. I.e. User’s dog’s size.

There is probably some trick or workaround here that I just can’t seem to figure out.

What do you see when you press do a search for after dogs? You should see a pop up box that lets you specify a new table and constraints to set.

Yes I’m able to do a search for dogs and set up the constraint. But then the overall repeating group search shows an error. It looks like that constraint is asking for a single ‘Dog’ but if I do that (i.e. just provide the first item), then my search will just show one result.

See attached screenshots. The app has real user data so I can’t share. But I may create a clone with fake data if you or someone else is not able to help.

Without seeing how everything is structured it’s kinda hard to tell, but I had a similar problem doing a search so here we go.

I assume you have a Dogs Table that is added to the user as a list. Add a user field to the dogs table and run an action to populate it from your users list. Then you can search for dogs instead of users but you can display the dogs owners(user) information and filter it if necessary.

1 Like

If the Search constraint doesn’t work for you then, it is often good to look at doing a filter. Or an Advanced filter.

You have two things: person and dog.

If you had three things: person and dog and ownership then you could use the ownership thing to avoid lists.

person

  • name
  • favorite color
  • list of ownerships

dog

  • name
  • favorite shade of grey
  • list of ownerships

ownership

  • dog
  • person

You could do a search for ownerships where the person’s fields match constraints and the dog’s fields match constraints. Then in the repeating group you could display the ownership’s person’s fields.

You are going to limit yourself like this. What new data is going to be introduced into Ownership that does not fit User or Dog? I would create a list of Dogs under User to signify ownership and an owner field(or use creator if the user is always entering their own dogs) under dogs, then store all relevant owner data under owner and all relevant dog data under dog. Like this you will be able to do a SEARCH for dogs and FILTER them based on owner criteria to get your initial results. This will allow you to the easiest and most efficient(based on my understanding) way to work with this data.

1 Like

@matt3 brings up a good point. If you ever expand to other pet types like cats then you will need to create new tables. It would be better to build a generic pet table and have type of pet as a field. This way it can be used for anything. I have this issue right now so I will build a new generic table but need to modify lots of Workflows.

@blueback09 good idea but I prefer to stay away from creating extra fields just to relate tables because then I have to remember to do it every time there is any change to data.

I managed to get this working with an advanced filter. Thanks @NigelG @matt3 @john3 for your help.

1 Like