Can you prevent the searchbox from showing entries that are spelt the same or to merge them?

Hi All ,

I was wondering if anyone has encountered this problem before, I couldn’t find a similar one on the forum , but if there is one, please feel free to link it to me.

I have a search box input bar on a page. This search box is then set up to search dynamic choices and searches a custom data type "products " . The field searched in the data type of ‘products’ is then “Generic Name” of the product. The problem I am encountering is that with what I am building, several products would have the same “generic name” and then I realised that bubble returns all generic names even duplicates as I will show below with a screen shot .

54

This means that if there a 25 products with atorvastatin for example, it will come up atorvastatin(1)- atorvastatin (25) even with just 3 key strokes of “ato” and would exclude other products with a different name which may also start with ‘ato’ e.g atomoxetine.

Is there a way I can set a conditional for the max entries returns , such that if a certain generic name appears multiple times in the search for products only show that particular generic name just one time e.g first item without disrupting the rest of the search?

so in the example above for atorvastatin to appear once and for atomoxetine to also just appear once i.e no duplicates in the suggested products by bubble.

I tried to find information on this on the forum but I couldn’t, find that much information about trying to put a conditional on the max entry .So if you have any information feel free to link it to this post even if you can’t answer the question.

Appreciations in advance for your help

Ayo

Hi @onamusia,

The reason this is happening is because each result in that list represents a different record, and you’ve told Bubble to display the Product Results by their Generic Name. If there are multiple Products with the same Generic Name, then Bubble is trying to help by numbering them off.

For the context of your search feature, you need to change the setup of the searchbox a bit. If you create a separate data type for Generic Product (with a text field for name) and use a different field called “Generic Product” that is type Generic Product under the Brand Product, then you can set the searchbox’s content type to Generic Product to search by that type instead. You’d only ever have one of each Generic Product record.

I assume right now the Generic is just a text field under Product though. I don’t believe the Search Box lets you set the content type to a plain text, so you’d have to get creative with a custom search if you want to keep that data structure. See this: https://www.youtube.com/watch?v=gF8mpZtfWLU

The method used in that lesson would allow you to create an expression like “Search for Products’s Generic Name :unique elements” - the Unique Elements modifier filters out duplicates.

Hope this helps!


Gaby at Coaching No Code Apps (formerly Coaching Bubble)

Courses & Products, Tutorials, Private Coaching, and High-level Development

Start Learning Today :mortar_board:

3 Likes

Hi Gaby,

Thanks for your response. I had a feeling it would not be possible with the current functionality but I just wanted to double check because at times they are workarounds that exist. I will try out your first suggestion as well.

My current workaround was to like you said create a new data type called Generic Name List. but Since I had the list of products already as a CSV file I just used the unique value function in google sheets to create a list of just the generic names and then I will use that data set for the generic name list data type.

Thanks for the response. I appreciate it .

2 Likes

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