Set incremental user id in database

Hello,

I see that Bubble sets its own unique ID for each new user in the database. How can I set my own user ID which increments by 1 for each new user that signs up? Would appreciate instructions on how to do this!

Thank you,
eye

Hey @eye,

You can have a new data type in your User data type called “User ID,” make that type a number. Then when a user signs up, for the “User ID” field you created you can put the following dynamic data: “Do a search for Users:last item’s User ID + 1.”

1 Like

That worked perfectly and the dynamic expression helps me understand Bubble better.

Thank you @johnny!

1 Like

Glad to help! Please feel free to shoot me questions in the future by tagging me :slight_smile: Glad to help anyway I can :slight_smile: – Welcome to Bubble by the way!

2 Likes

Johnny, attempting this but I’m missing something apparently.

This is what I have:

Do I need another TYPE as user_ID? And then have that in the user table?

thanks!

Hi there, @mfsmillie… I would guess the reason your setup is not working is the privacy rule(s) on the User data type prohibiting users from being found in searches. So, take a look at that and see if that’s the case.

Best…
Mike

1 Like

@mikeloc Yes, indeed. Much appreciated!! :star_struck:

1 Like