How to asign properties to objects correctly

Hello, and Happy Easter!
Our app is close to be ready, but there are some things that need to be fixed, quickly.
The issue lies in storing and using some data in firebase.
On a previous post, I had some issues with the sign up/sign in, but that’s now working just fine.
Now, there are … things I need help with:

  1. When you first register, the app guides you through a profile setup. Now, what I want is to store all of this data under each user.



Now, the problem is, after registe there’s no such thing as an user id, unlike log in, which I would need so that I could store that info under each user.
image
image

I tried this thing but I don’t know if it’s okay:

When I try to use the app, the stored data looks like this:


When it should look like this:
image

How can I make this functional?

  1. After the data is stored, it shall be used. One of its most important uses is in creating two “branches” of the app. Is this done correctly here? (edit: yes, it is)

  2. Finally, the most important aspect of this app is sharing a location(also depending on the branches). Basically, one user is gonna send his location, and the other will receive it, alongside an alarm. How can I make it possible, based on their ID?

(I did this based on LocTrackerv2 app)

Please, please, help us(it’s a team work for a competition). Thank you so much in advance.
Here is a link to the app:Thunkable

In the screenshot above, your sign in block has the default values for email and password (hello@gmail.com / hello):

image

You need to add the email and password values that the user typed in there.

Then, the green user id block will have the value you need for Firebase. Just store that in a variable (app variable userID).

Oops, thank you for noticing this, changed it now. But we still need help on the issues mentioned in the post. Could you please look over the project and help us?

You asked a lot all at once. So I chose one part to help you with.

What specifically do you need help with now?

I’m so sorry :(.
The most important aspect right now is storing the user data correctly in the database.

What happens when you set cloud variable app variable userID to an object with only text values (no latitude, longitude, etc.)?

Do you have that working? If not, can you save anything to Firebase successfully?

Yes, I can save the latitude,longitude and also the image you upload. I cannot save the branch(“ramura”) though, which is the most important data.

These buttons don’t add any data to Firebase?

image

They should. But they also should replace each other’s data because the path and object names are identical. I would expect to see this after voluntar is clicked:

[userID]/ramura : voluntar

And this after pacient is then clicked:

[userID]/ramura : pacient

Ok, so what happens now is that I select the data, then it is stored, and then it literally disappears. I don’t get why.

There must be something else deleting those nodes from Firebase. Check to see that you don’t have any stray blocks assigning values to Firebase paths. Is anyone else you know using the project or a copy of the project that can access Firebase?

If you can’t figure out the cause, start to slow things down. Add wait blocks so that you can watch the Firebase values to see when they change. It helps to do something visual on the screen like change a label’s value right before the wait block so you connect that to what is happening in Firebase. This is the method I use for debugging blocks: Debugging in Thunkable X (Video).

1 Like

Thank you a lot!
and sorry for bothering you so many times :(.

1 Like

I managed to find out what’s the problem here.


you have to create the object ONE TIME, with empty values, and then asign them as you go on. You cannot “add new fields” as you go on, because that will just get overwritten over the other fields.

Thank you once again for your help!

1 Like

I think you can do that with the Set Property of Object block. I haven’t tried it myself but see this:

1 Like