# Realtime\_DB1 call Get does not returm en error when the key does not exist

**URL:** <https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861>\
**Category:** Questions about Thunkable X\
**Created:** [December 28, 2020, 3:58pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861 "2020-12-28T15:58:23Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 28, 2020, 3:58pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/1 "2020-12-28T15:58:23Z")

</div>

In this example :

 ![Realtime_DB1 Get](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/2/42eeda2264efb2b6883c365f555b36ad329bd103.png)  
When the key (Evenement/2020/test3 ) exist there are no problem.  
If the key does not exist (for example( (Evenement/2020/test1 )), so if this record does not exist (Evenement/2020/test1 ) in the realtime Db (firebase)  
The IF not error is dedected , so there an error (else) Then the error is not displayed , the App block !!!  
Can some one give me an idea about the resolution of this problem ?

---

<div class="post-metadata">

**Author:** ![v.krishna](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/v.krishna/32/84811_2.png) [@v.krishna](https://community.thunkable.com/u/v.krishna)\
**Post date:** [December 28, 2020, 4:04pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/2 "2020-12-28T16:04:29Z")

</div>

> [@ealalin13s68](#):
>
> When the key (Evenement/2020/test3 ) exist there are no problem.  
> If the key does not exist (for example( (Evenement/2020/test1 )), so if this record does not exist (Evenement/2020/test1 ) in the realtime Db (firebase)  
> The IF not error is dedected , so there an error (else) Then the error is not displayed , the App block !!!  
> Can some one give me an idea about the resolution of this problem ?

Sorry, I didn’t get that at all. Can you rephrase it and tell again?

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 28, 2020, 4:17pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/3 "2020-12-28T16:17:29Z")

</div>

The function realtime\_Db1 call get with a key ; work well if t:he key exist .  
example in the Realtime record into Firebase.

 ![Realtime_DB1 record](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/5/5503a433ae76c675edbaa81662c3cbea41fcded1.png)

Then if the key exist like showed :Evenement/2020/test3 the get works perfectly.  
Now if I want to make a call get from a key who does not exist then i’m waiting to receive an error. Is not the case in state of receiving an error the App block

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 29, 2020, 11:47am UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/4 "2020-12-29T11:47:41Z")

</div>

in stade of receiving an error I see a blank / white screen when you live test (even if there are items in my app) and I m blocked. Do you have any idea to resolve this problem ?

---

<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:** [December 29, 2020, 8:10pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/5 "2020-12-29T20:10:40Z")

</div>

You could check for a value of null (does not exist) or you could use cloud variables instead of the realtime db block. When you use cloud variables, you’ll also need to check for a null value, I believe.

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 29, 2020, 9:13pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/6 "2020-12-29T21:13:30Z")

</div>

The value null is well detected , the value is in this case “undefined” .  
Special character like " # , / …etc " are also detected , in this case a error is detected.  
But what I need is to detect if the variable entery is existing or not in the realtime db.  
If the value is existing there is no problem.  
if the value is not existing in the Realtime db , then I get a problem ,my screen freeze wite .  
I would expect the function "in Realtime Db1 call get " with a key (in my example:“Evenement/2020/test1”) could trap an error if the specific key does not exist in the Realtime Db1.  
Is there a correction for this case ?  
I looked in the chats of the community , but I can not find any solution already treated on this subject

---

<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:** [December 29, 2020, 9:20pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/7 "2020-12-29T21:20:37Z")

</div>

Have you tried this?

If cloud variable “Evenement/2020/test1” = null  
Set label to “does not exist”?

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 29, 2020, 10:00pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/8 "2020-12-29T22:00:52Z")

</div>

![Capture01](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db8eb57a901a8c75598bea50b6ca65bb7174bd90.png)  
If I replace the key by “null” then I receive in the text input a value from " get property of object “Name” to undefined but this does not tell me that the value test1 from the key Evenement/2020/ **test1** does not exist.

If I replace the key by Evenement/2020/null then the problem stay the same my screen freeze wite.

---

<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:** [December 29, 2020, 10:30pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/9 "2020-12-29T22:30:47Z")

</div>

Sorry, I don’t think you’re understanding me. I’m not suggesting using the Realtime DB block at all… I’m suggesting trying exactly this:

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

By the way, it works for me. 🙂

See this for more info about accessing Firebase using only cloud variable blocks: [Replace GET or SAVE Blocks with cloud variables](http://community.thunkable.com/t/thunkable-hack-deep-firebase-json-data-manipulation-without-using-get-or-save-blocks/975738)

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 29, 2020, 10:46pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/10 "2020-12-29T22:46:17Z")

</div>

thx , I will look on it tommorrow

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 30, 2020, 7:25pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/11 "2020-12-30T19:25:33Z")

</div>

Hello I m back find below some test that I have just make ; onother thing that I have to add is that all my App is using the realtime DB , that why I m afraid to hear not to use it .

 ![Cloud Variable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/9/f9d8ecc2ca7402a319b4dd10fee546b45e9fcddb.png) .  
This cloud variable is working very well I get directly the name , info , doc … all the property of my record from firebase and in surplus I can show the field name(Date,Document,Info,Name) of my keys thx for it .

using only the cloud varaiable if the key is not existing of a part of the key ( in our case the key part" test1 " of Element/2020/test1)in the real time db then the problem remain the same my screen go white and the App is blocking

---

<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:** [December 30, 2020, 7:29pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/12 "2020-12-30T19:29:49Z")

</div>

It sounds like you’re wanting to stick to using the realtime db even though it’s not working for you.

If you use cloud variables instead, you won’t have that problem.

---

<div class="post-metadata">

**Author:** ![ealalin13s68](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ealalin13s68](https://community.thunkable.com/u/ealalin13s68)\
**Post date:** [December 30, 2020, 7:47pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/13 "2020-12-30T19:47:25Z")

</div>

In any case thankx very much for your support , it was very usefull and educational.  
In other end I thing it’s petty that using thunkable reading Firebase a trap on key not found is not add or eventually a time out .Maybe this is a subject to go back to the developper of thunkable. but for that i am still too new to this site and still too little experienced .  
One more time thx and I wish you a happy new year …coronna free

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [December 30, 2020, 8:44pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/14 "2020-12-30T20:44:45Z")

</div>

Keep coming back with questions!! Happy Thunking!

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:19pm UTC](https://community.thunkable.com/t/realtime-db1-call-get-does-not-returm-en-error-when-the-key-does-not-exist/1041861/15 "2024-11-08T12:19:20Z")

</div>


