Forum Academy Marketplace Showcase Pricing Features

Why I can't search a "unique ID" in a list?

Cattura

Why is not possible to use “ISN’T IN” for “unique id” value while it’s possible for other fields?

When I use a list i prefer to collect “unique id” values instead of other fields (that can be changed by users for example).
I think that this missing feature would be added.

Thanks for help.

1 Like

I want to know too!

1 Like

I’m facing the same problem.
I did a turn around that I don’t like, but it’s solving the problem by now:

Let’s say I just want to list videos that the user has never saw.
I have 2 things: Videos and User_Videos

  1. I created a slug for each Video
  2. I saved the Video in the User_Videos as video
  3. I saved the Video Slug int the User as video_slug
  4. I do a Search for Videos where Slug isn’t in User_Videos video_slug

It’s not a good solution, but it’s helping me until they do the correct way.

I recall seeing one of the founders say in a post years back that UniqueID was handled differently by Bubble, which is why you can’t do an “is in” type of search. But regardless it’s a major pain. As a workaround you need to search a record based on some other field and ensure that field is unique. This may mean creating a text field and copying over the UniqueID into it, which feels messy but I don’t see a way around it.

In my case I’m running into this when trying to do a nested search of a joining table (which I’m building to try to avoid an advanced filter on a many-to-many search). If I have Items, and Tags, and an Item_Tag joining table, in my Item search constraints what I want to say in essence is… this Item is in search for Item_Tag’s Item. However there’s no such expression. Instead you have to pick a field and say… Item’s Field is in search for Item_Tag’s Item’s Field.

1 Like

You can use “Unique ID isn’t in Do a search…'s unique ID” if you put that on a “:filter” → Advanced.

The “:filter” problem is that it takes longer to search, but if you don’t have that much Data, it may help you too

1 Like

I feel like advanced filters are a band-aid – they work fine with small amounts of data, but as you grow and scale, it becomes a problem.

1 Like

This is a good solution for one of my cases. Thanks for sharing.

It might help if you create a new field called self_id (text)- and then populate it with the thing’s unique_id after its creation. We use it pretty often.

you win! Thanks

1 Like

Wow, I didn’t know this. Another way to get around it is to use the slug field. The added benefit is that it is guaranteed to be unique. But you have to set it.

CleanShot 2021-11-29 at 16.26.08

1 Like

As I know, the Bubble engine already takes care of id’s uniqueness when you create a new thing. So, you just take the thing’s unique_id and set it as the thing’s self_id (the same thing).

The slug can be changed, while the unique_id - not.

Oh, duh, Rico!!
Of course, you’re only copying the IDs so, yeah, it will be unique.
Count that previous comment as a loud ‘brain fart’.

1 Like

:joy:

The important thing is not to mess with the steps when you create several things in a workflow.
I mean, when you create Thing 1 and Thing 2, be sure that you set Thing 1's self_id as Thing 1's unique_id, not Thing 1's self_id as Thing 2's unique_id like when I accidentally did for a task… :sweat_smile:

Do you all know if this same issue applies to getting data via the API? I’ve tried to no avail to get my users by a list of their IDs using a constraints object :frowning:

1 Like

nm, i got it working by _id w/ an in constraint type in API.

My issue was an encoding one