Removing Duplicates in Searchbox Results

Hi Bubblers,

I’ve searched about this in the forum and also in online resources but didn’t manage to find any useful resources.

Would anyone have a solution to remove duplicates like in the image below without having to create a new table with unique records?

If they appear with (1), (2) etc in the dropdown, probably, they have their own record in the database. So, they are separate elements with some difference, so Search for XXXXX:unique elements wouldn’t work in this case and you have to do some manual filtering.

If you didn’t mean to add these 7 times, then your add logic might require some change.

Maybe give us more context.

@bkay grab this plugin to apply to all the pages in your app - Searchbox: no duplicate Plugin | Bubble

Or grab the code from the plugin and apply to any page you don’t want to show duplicate values.

Next, as the searchbox is showing various records with ‘ERA Realty Network Pte’, you’ll have to play around with displaying the values that you would like the end search to utilise. (e.g. other parameters you may be using).

Good luck!

Hi @hergin , thanks so much for chiming in again and appreciate it! For a search for company, I’m using the data table to query which includes projects from that company so I mean to add them 7 times because they are uniquie projects of that company.

Just wondering if there’s a way to remove duplicates when displaying in searchbox without having to create a separate table for companies

Hi @DjackLowCode is this the correct way to add it?

I’ve tried using the code in the HTML Header of the page and duplicates are removed! Just have 2 more questions :

  1. If there are any more HTML codes I need to apply to the page, will there be any issues?
  2. If the plugin no longer exists, will it affect anything? Or is the reason you asked to grab the code instead of using plugin is to prevent the app from having any issues if the plugin no longer exists?
  3. How can I apply the code to just one element?

All the plugin does is add that code to your headers of all your pages (and therefore all your searchboxes).

The code lives on even if that plugin is made unavailable. Bubble might change their code for searchboxes which might affect this in future - but not something that you have control over.

You could adapt it to a single element by its ID if you’re familiar with Javascript, but the plugin code covers all searchboxes on this page.

Remember that the searchbox looks for items in your DB table - so each one of the duplicates was previously an individual item from this table. So, assuming your using this in searching or filtering with other parameters, you’ll need to reference this searchbox with something along the lines of
““this thing’s realtor = this searchbox’s realtor””

Hope that makes sense.

1 Like