# How to read the data path ( key ) from firebase?

**URL:** <https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382>\
**Category:** Questions about Thunkable X\
**Created:** [December 31, 2019, 4:57pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382 "2019-12-31T16:57:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidsobhysabetb](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@davidsobhysabetb](https://community.thunkable.com/u/davidsobhysabetb)\
**Post date:** [December 31, 2019, 4:57pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/1 "2019-12-31T16:57:21Z")

</div>

Hi,  
I added a ’ Listeners ’ to firebase and i wanna figure out what is the path when data change in firebase ,  
what i did is adding :  
Path/State  
to listener , the problem is : when reading the ’ key ’ it would be like that :  
State  
so how to identify the whole path ?  
thanks in advance .

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 1, 2020, 8:45am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/2 "2020-01-01T08:45:36Z")

</div>

Hi,

> so how to identify the whole path ?

There is no such possibility. To determine the path, you must create a listener on the end node and map the path to it.

---

<div class="post-metadata">

**Author:** ![davidsobhysabetb](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@davidsobhysabetb](https://community.thunkable.com/u/davidsobhysabetb)\
**Post date:** [January 1, 2020, 10:05am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/3 "2020-01-01T10:05:34Z")

</div>

I still can’t get it ,what if I have 2 Different paths having different names but having the same contents ?  
Product1/State  
Product2/State  
And added the the two State as listeners  
What exactly should I do when firebase data changed ?  
Thanks a lot for your support .

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 1, 2020, 12:52pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/4 "2020-01-01T12:52:26Z")

</div>

When the listener is triggered, you need to write the path of this listener to the variable. There is another way - to create 1 listener, but when it works, you will need to loop through all children nodes and determine the one in which the data has changed.

---

<div class="post-metadata">

**Author:** ![davidsobhysabetb](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@davidsobhysabetb](https://community.thunkable.com/u/davidsobhysabetb)\
**Post date:** [January 2, 2020, 7:30pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/5 "2020-01-02T19:30:31Z")

</div>

Thanks a lot, I solved the problem by making an additional listener named it with the path name so when data changed it tells me who exactly changed to check .

---

<div class="post-metadata">

**Author:** ![dns.prado.s3vy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/dns.prado.s3vy/32/57577_2.png) [@dns.prado.s3vy](https://community.thunkable.com/u/dns.prado.s3vy)\
**Post date:** [January 22, 2020, 12:13am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/6 "2020-01-22T00:13:18Z")

</div>

Hi David,

I have the opposite problem. I have put the listener to listen to tag1/tag2, but when data changes, the ‘key’ variable gives me tag1 and not tag2. Could you please upload some pictures of your blocks after you corrected it?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dns.prado.s3vy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/dns.prado.s3vy/32/57577_2.png) [@dns.prado.s3vy](https://community.thunkable.com/u/dns.prado.s3vy)\
**Post date:** [January 22, 2020, 12:41am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/7 "2020-01-22T00:41:43Z")

</div>

Hi again. I Actually solved it. Of course it was just a lack of attention of mine 😅.

Cheers

---

<div class="post-metadata">

**Author:** ![davidsobhysabetb](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@davidsobhysabetb](https://community.thunkable.com/u/davidsobhysabetb)\
**Post date:** [January 23, 2020, 8:28pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/8 "2020-01-23T20:28:48Z")

</div>

Actually it’s the same problem !  
I solved it by making an additional listener & child naming the wanted ’ Tag ’ then of it’s data changed i get that listener data changed .  
So, how did you solve yours ?

---

<div class="post-metadata">

**Author:** ![dns.prado.s3vy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/dns.prado.s3vy/32/57577_2.png) [@dns.prado.s3vy](https://community.thunkable.com/u/dns.prado.s3vy)\
**Post date:** [January 24, 2020, 12:02am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/9 "2020-01-24T00:02:27Z")

</div>

In my case, in the listening block I had put tag1/(other variable). This other variable wasn’t a path in Firebase hehehehe

---

<div class="post-metadata">

**Author:** ![davidsobhysabetb](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@davidsobhysabetb](https://community.thunkable.com/u/davidsobhysabetb)\
**Post date:** [January 24, 2020, 8:12pm UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/10 "2020-01-24T20:12:01Z")

</div>

🤣 🤣 🤣 🤣 🤣 🤣 🤣

---

<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, 11:45am UTC](https://community.thunkable.com/t/how-to-read-the-data-path-key-from-firebase/387382/11 "2024-11-08T11:45:52Z")

</div>


