# Create and Save Data in Firebase

**URL:** <https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, beginner, help\
**Created:** [January 14, 2023, 4:11pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431 "2023-01-14T16:11:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 14, 2023, 4:11pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/1 "2023-01-14T16:11:00Z")

</div>

Hi there,

I made an apps for school and I need to save data in firebase but when I did my block, the data doesn’t showed up in firebase. Its doesn’t upload. Am I doing it wrong ?

 ![Screenshot 2023-01-15 000648](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/5/d5fa9ec26aeacbfe102e87bdde6da3df5322e91f.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2023, 4:33pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/2 "2023-01-14T16:33:07Z")

</div>

It looks like that should work.

Try this:

1. Set a label’s text to these blocks and tell us what you see when you do that:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/6/16d44c1702b1423303e5ed6c72de6fd5365bdf8d.png)

That will confirm that the cloud variable path is correct.

1. Try a simple Firebase save by setting cloud variable [join] [app variable userId] [“/test”] to “this is a test”

Check your Firebase realtime database and let us know if “this is a test” shows up for that user under the “test” key.

That will confirm that you can write to Firebase.

---

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 14, 2023, 4:55pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/3 "2023-01-14T16:55:58Z")

</div>

I’m sorry but can you explain it in more detail ? I don’t really understand what you meant by the 2 point that you said.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2023, 5:07pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/4 "2023-01-14T17:07:38Z")

</div>

When you try something complicated in Thunkable and it doesn’t work, the best thing to do is to try the simplest form of it you can and see what happens. If that doesn’t work then the more complicated thing won’t work.

So I’m suggesting that you modify these blocks:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/3/d39ef64ade401f6dfad975c8157ac94fd977bb96.png)

Another way to do this is to remove the [convertemailToId] block from the join block and then set the cloud variable to a text string (instead of an object).

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2023, 5:15pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/5 "2023-01-14T17:15:38Z")

</div>

Does any data change in Firebase when you try this?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/7/0787cc9ccdb147e7003303fdc09a525aeab2c80d.png)

---

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 14, 2023, 5:20pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/6 "2023-01-14T17:20:24Z")

</div>

no, nothing change.

---

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 14, 2023, 5:25pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/7 "2023-01-14T17:25:17Z")

</div>

Did you mean like this?

![Screenshot 2023-01-15 012429](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/8/b8474a8e6288aff1ee062e7d96b557ccdeea7dc7.png)

Does the database location give effects to it ?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2023, 6:16pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/8 "2023-01-14T18:16:15Z")

</div>

> [@emelptacz](#):
>
> Did you mean like this?

Yes.

> [@emelptacz](#):
>
> no, nothing change.

Then either your Firebase authentication settings in Thunkable are not correct or your rules in the Firebase console are not correct. See this: [Realtime DB by Firebase | Thunkable Docs](https://docs.thunkable.com/v/snap-to-place/realtime-db#edit-database-rules)

> [@emelptacz](#):
>
> Does the database location give effects to it ?

I don’t know what you mean.

---

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 14, 2023, 6:58pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/9 "2023-01-14T18:58:44Z")

</div>

I did it, but the things is whenever I tried to key in another data, it will change the previous data into a new one. I don’t want it to change the previous data into a new one cause I would like to save all the data. Whats the problem here ?

 ![Screenshot 2023-01-15 025824](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/e/1ee6c058548b12008765fcb50b4f418efbc7d968.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 14, 2023, 7:42pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/10 "2023-01-14T19:42:30Z")

</div>

If you set cloud variable [app variable userId]/path to a value, it replaces all data below that path. It doesn’t make sense to use a path like [app variable userId]/ **users** because the userId should be the unique key within the path. You wouldn’t want multiple users under [app variable userId]/. So a better approach is to organize Firebase like this:

```auto
Users/
   [userID]

```

Where you keep adding userIDs below Users/ like this:

```auto
Users/
   sjfh327857343
   oight2y982351
   kashjfsgd2314

```

And inside of each [userId] key you can have paths to objects or values:

```auto
Users/
   sjfh327857343/
      fullname
      NRIC
   oight2y982351/
      fullname
      NRIC
   kashjfsgd2314/
      fullname
      NRIC

```

---

<div class="post-metadata">

**Author:** ![emelptacz](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@emelptacz](https://community.thunkable.com/u/emelptacz)\
**Post date:** [January 17, 2023, 2:23pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/12 "2023-01-17T14:23:00Z")

</div>

Thank you, now I already got it !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [April 17, 2023, 2:23pm UTC](https://community.thunkable.com/t/create-and-save-data-in-firebase/2222431/13 "2023-04-17T14:23:02Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
