How to check the name repeated in firebase with thunkable x

I need to check if I already have a username repeated within my database and create a condition. however, I don’t know which complement I use to make such a process

Hi @ronymarcosdci,

You can list objects in Firebase. Might look something like this, though I don’t know exactly how your Firebase is laid out.

Display Firebase objects as list:

image

Firebase example for these blocks:

image

Creates this:

You can use an if statement like this to check if the username exist in the list:

image

If you send in a screenshot of what your Firebase Database looks like I can show you how to alter the blocks a bit if it doesn’t look the same as the example :slight_smile:

you were great, i’m creating a registration method, and as soon as the user clicks create registration the app should check if that username is available … at the moment the logical blocks on the platform are just to save the data entered

Hi,

I meant your Firebase Realtime Database, can you send me a screenshot that looks something like this:

image

This screenshot is from console.firebase.google.com/ —your—project—here—

Are you wanting to check the object nome for duplicates?

no longer, now is the CPF

If cpf is always the same as its parent object, then the blocks above should work fine, if it is not the same, you can simply add in a get property of object block, like so:

If your tag cliente has a parent then you could need to adjust the Firebase key value slightly to adjust this.

You can then use the sort blocks that I had showed you above already. Let us know how you get on, and if this worked you can mark it as solved :slight_smile:

1 Like

Ok, now I’m going to test <3

1 Like

You may be ale to do this without much code in thunkable.

Make a rule in your realtime db that validates for duplicates. Might look something like, “.validate”: “!data.exists()”.

Then you can check using your realtime db block and if there is a duplicate it will return an error.

1 Like

You should print a document to assist if it is not too much abuse of me?

there is no more got value in fire base?

@ronymarcosdci what do you mean?

@ryan_hall_apps you should post a guide here on how to achieve the same result as the few blocks shared above, just as future reference for anybody searching this topic.

Thanks.

Sorry everyone, I thought Firebase would validate for unique values. This does not seem to be the case and is feature request by many users.

**Using Firebase rules does not work to find unique values.

2 Likes