# Due to change in blocks, Need help for retrieving data from firebase

**URL:** <https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, database, beginner, help, blocks\
**Created:** [May 12, 2021, 9:44am UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245 "2021-05-12T09:44:46Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 9:44am UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/1 "2021-05-12T09:44:46Z")

</div>

I have made a project which requires me to search and see if the user input is equal to a value in my database. I’m aware of the similar posts here, however, the answers have different blocks which makes it difficult for me to follow and their data retrieval requirements are different from mine. Any insight would be deeply appreciated. Even the posts from December 2020 have different blocks to what I can find.

This is a simplified version of my actual project :

This is my screen :

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

This is the database :

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

1. I want to take the input from text field and check if that User ID is present in the database. If it is present, I want to change the label that displays “Well…” to “Yes, it matches!”.
2. I also want to change the label “Does It Match?” to the Name associated with the ID in the database.

Please let me know if you need any other information. I have been trying to figure this out for so long but with no luck. If anyone could explain the concept behind the blocks too, that would be very helpful for me to retrieve the data in other ways as well.

---

<div class="post-metadata">

**Author:** ![Dean\_Artis](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@Dean\_Artis](https://community.thunkable.com/u/Dean_Artis)\
**Post date:** [May 12, 2021, 10:10am UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/2 "2021-05-12T10:10:05Z")

</div>

What have you tried so far? Show your blocks.

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 11:17am UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/4 "2021-05-12T11:17:33Z")

</div>

I’ve tried quite a few combinations :

1. 

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/2/82a5d6c77ae1ea4b02a223f66b5cf0fcb5265906.png)

1. 

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

1. 

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

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 12, 2021, 1:26pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/5 "2021-05-12T13:26:31Z")

</div>

When you go in the loop "for each “j” in …, “j” actually has what is under the key “UserID”. But you are using a single “key” just under the “UserID” key and therefore you should check this way

In the loop it should say [for each “j” in list [get object properties of] [cloud variable UserID]  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/1/81d0853719a2fafe27b04e28c3f17f269cc145e1.png)

if [EID Input text] = [j]

This will get you the correct result.

---

<div class="post-metadata">

**Author:** ![backscratcher2007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/backscratcher2007/32/104623_2.png) [@backscratcher2007](https://community.thunkable.com/u/backscratcher2007)\
**Post date:** [May 12, 2021, 1:38pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/6 "2021-05-12T13:38:22Z")

</div>

Correct me if I am wrong but the data is from a firebase database right? So you would need the [Realtime DB component](https://docs.thunkable.com/realtime-db).  
And welcome to the community!

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 1:42pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/7 "2021-05-12T13:42:54Z")

</div>

Thank you so much! I’ll try that out.

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 1:44pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/8 "2021-05-12T13:44:16Z")

</div>

Yes, but I believe while using cloud variable, Realtime DB component isn’t needed. And thanks for the welcome!

---

<div class="post-metadata">

**Author:** ![backscratcher2007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/backscratcher2007/32/104623_2.png) [@backscratcher2007](https://community.thunkable.com/u/backscratcher2007)\
**Post date:** [May 12, 2021, 1:45pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/9 "2021-05-12T13:45:12Z")

</div>

To access the data from your database you would need that component

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 12, 2021, 1:49pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/10 "2021-05-12T13:49:34Z")

</div>

@backscratcher2007 You should not need Realtime DB components and the cloud variable are not only direct but also works in a synchronous mode which eliminates a lot or uncertainty. You also have the `listeners` readily available for all variables which can monitor any outside changes to the database making it easy to implement multi use capabilities  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/f/bf768a3b9ab47ea7c0552454fdac2ea3e18eefe6.png)  
using this block will allow you to know and interact with any change taking place in the database whether from the app or from other sources.

---

<div class="post-metadata">

**Author:** ![backscratcher2007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/backscratcher2007/32/104623_2.png) [@backscratcher2007](https://community.thunkable.com/u/backscratcher2007)\
**Post date:** [May 12, 2021, 1:54pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/11 "2021-05-12T13:54:06Z")

</div>

But if @ads_imposters has a private database, how would she use cloud variables to get her data from her database without api and databaseURL?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 12, 2021, 1:57pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/12 "2021-05-12T13:57:19Z")

</div>

You need to go to project settings page and fill in the API key and Database URL exactly as you would do if you plan to use the components.

In the other hand, the DnD UI does not have the database component and you are left with the cloud variable to interact with Firebase. So better use them from **now**.

---

<div class="post-metadata">

**Author:** ![backscratcher2007](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/backscratcher2007/32/104623_2.png) [@backscratcher2007](https://community.thunkable.com/u/backscratcher2007)\
**Post date:** [May 12, 2021, 2:01pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/13 "2021-05-12T14:01:03Z")

</div>

oh right, I just checked the documentation on variables.

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 2:12pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/14 "2021-05-12T14:12:26Z")

</div>

Yes, its working now! Thank you so much!

If I want to get the name under the UserID, I will have to put another loop under the main loop, like this, correct? :

[for each j] in list [get properties of] [cloud variable TestInput]  
then, display [j]

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 12, 2021, 2:15pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/15 "2021-05-12T14:15:22Z")

</div>

If I understand your structure, you can just use the cloud variable format /userid/(user\_id\_variable\_that\_you\_figured\_out)/name

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 12, 2021, 2:18pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/16 "2021-05-12T14:18:53Z")

</div>

In side the loop do something like this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/4/24849f22dd61b316e91a67c0d358f39a3b3f7b3f.png)

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 2:40pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/18 "2021-05-12T14:40:26Z")

</div>

Yes, I can do that using the get property…of object…, Right?

---

<div class="post-metadata">

**Author:** ![ads\_imposters](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ads\_imposters](https://community.thunkable.com/u/ads_imposters)\
**Post date:** [May 12, 2021, 2:41pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/19 "2021-05-12T14:41:28Z")

</div>

Got it, Thank you!

---

<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, 1:22pm UTC](https://community.thunkable.com/t/due-to-change-in-blocks-need-help-for-retrieving-data-from-firebase/1278245/20 "2024-11-08T13:22:34Z")

</div>


