Forum Academy Marketplace Showcase Pricing Features

Doing a Search of a Database on page load and using the result on multiple drop downs

Hello, I’m trying to figure out how to “Do a Search” (without constraints) on the database and storing that in some kind of list that I can then use as a SOURCE for populating several (over a dozen) dropdown elements within the page with differently constrained bits of the initial data.

I want to do it like this because I would have an initial “Do Search” at the start of the page, instead of having to do a search on EACH dropdown.

  1. Is this possible?
  2. Are there any plugins that I would need?
  3. Could I just get the “List” of items into a group and then source them into the dropdowns?

I’m not using repeating groups in any way.

Thanks in advance for any and all help.

@brito4you

Why not use a repeating group?

Place one in a popup so that it is hidden from the page
Name it “data - things”
Then in the dropdown refer “data - things” as your data source

2 Likes

Hey @brito4you

Yes. :blush: You should be able to set a state on page is loaded. That way you will be able to access that list from multiple places. Have you used set states before?

You can also do the same thing with how @cmarchan suggested too.

Great idea by the way, this is a great way to make sure you app is optimized. Avoid doing the same search more than once. :+1:

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

  • One-on-One Tutoring
  • eLearning Hub
  • Video Tutorials
3 Likes

Thank you. I thought about something like this, but didn’t know I could get the data from repeating groups outside of them.

I will look in to this solution.

Thank you.

I have used state a bit, and I generally like utilizing them, but I had not thought of them when it came to this solution.

I will look into this.

1 Like

FOLLOW-UP
I’m currently working on adding the searched data to state and that is working alright. I have a another question…

Once I get the data from the search on the State, when I use that data on a dropdown, can I “constraint/filter” it there in the dropdown?

Or should I create different states for each of the constraints I need and use those instead?

Thanks again for everything!

Hey @brito4you

You can filter it in the dropdown. You are already pulling the data in, so you don’t need to pull it in again. Just add ‘:filtered’ at the end and you can add your constraints. :blush:

1 Like

I don’t know much about these specific operators, like “filtered”. I will definitely look into using them more.

I have one more question, that just popped up while I tried to apply the same logic, but using a “Search Input” instead of a Dropdown.

I noticed that with the Search Input, it seems, I HAVE to search within the Database, I haven’t found a way to search within the data that I loaded into my state…

Is there a way to do this? Perhaps a plugin that allows for this?

AND, IF it is not possible, would it be bad for performance/bandwidth to have 40 search inputs on one page to fill out a form? If I could just “search” within the initially loaded data I wouldn’t even have to consider this…

Thank you so much for the continued help.

Hey @brito4you

I know the search box input is pretty restricting. I don’t normally use it just for that reason. I don’t think it would be that great of an idea to have 40 search inputs for your form. It might work, but it would most likely be pretty slow on page load. I haven’t seen a way to have that data change dynamically. There isn’t even a way to change the data based on a condition. So I am not sure if it’s possible. Maybe someone else has seen a plugin that has been able to do this.

Thank you so much for your response.

I still haven’t found an alternative to this, but I’m working with it, or around it, I will see.

Thanks again.

1 Like