Forum Academy Marketplace Showcase Pricing Features

How do I remove duplicates using :unique elements?

Hello,

Just wondering if anybody has had success using :unique elements to remove duplicates. I am trying to create a drop down of states using the dynamic data of states already stored in the database. The :unique elements operation is not working with my current arrangement and still displays duplicates. Any ideas? Please see the image below.

Best,
Derek

I’m pretty sure that what’s happening is that you have some current states entries that have the same state. Keep in mind that the unique operation compares the things ‘current states’, not the state field. If you want to make sure you only have state once (the text), what you should do is

  1. change the type of the dropdown to text
  2. define the choices source as search for current states’s state:unique elements

in this case though, the dropdown will return a text, not a current states.

Makes sense?

1 Like

Emmanuel,

Thank you for such a prompt response! I followed your instructions then added current option to the option caption field and it worked perfectly. I am really enjoying Bubble so far and can’t wait to finish building my first app :grinning: .

Many Thanks,
Derek

Derek, Can you place a screenshot of the panel for your solution? When I change it to text, the search field does not allow me to pick anything but types. Thanks

Oh see the problem that is causing lot of confusion. When you CLICK on the next possible options after the Search for (type) the options start with “:” which makes you think that there are no fields available. All you have to do is scroll down to find the fields you want to show.

So: "Search for <field*>:unique elements

  • make sure to scroll further down beyond choices that start with “:” to find the fields

Hope this save someone the time I spend looking for a solution.