# Receive data from firebase to sum

**URL:** <https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180>\
**Category:** Questions about Thunkable X\
**Created:** [May 25, 2021, 4:24pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180 "2021-05-25T16:24:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccosta](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ccosta/32/106141_2.png) [@ccosta](https://community.thunkable.com/u/ccosta)\
**Post date:** [May 25, 2021, 4:24pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180/1 "2021-05-25T16:24:31Z")

</div>

Good afternoon everyone,  
could someone help me get a specific value of firebase for sum because i am having difficulties. I’ve tried a few things but to no avail.

I would like to get all the fields named “consumption” and make the sum

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

{  
“55AMJ05081990CAA|2” : {  
“13h17m2” : {  
“consumo” : 80,  
“vendor” : “Joelton”  
},  
“13h17m30” : {  
“consumo” : 25,  
“vendor” : “Maria”  
}  
},  
“55CPC08101987MAA|2” : {  
“13h16m42” : {  
“consumo” : 503,  
“vendor” : “Joelton”  
},  
“13h17m17” : {  
“consumo” : 30,  
“vendor” : “Maria”  
}  
}  
}

---

<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:** [May 25, 2021, 5:09pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180/2 "2021-05-25T17:09:25Z")

</div>

What have you tried? Can you share a screenshot of your blocks? There might be a simple correction that can be made.

---

<div class="post-metadata">

**Author:** ![ccosta](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ccosta/32/106141_2.png) [@ccosta](https://community.thunkable.com/u/ccosta)\
**Post date:** [May 25, 2021, 6:40pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180/3 "2021-05-25T18:40:25Z")

</div>

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

Sorry, I removed the blocks.  
I had tried to treat the list with objects but to no avail.  
So I just managed to get this far and get to this list. But what I really need is to add what’s on the list.  
Follow where I left off.

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/c/6cbb6531e2fa68b77255f5b98830a6f0e120bdd9.jpeg)

---

<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 25, 2021, 7:17pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180/4 "2021-05-25T19:17:07Z")

</div>

First to notice is Firebase already provides you with the green value as an object. You should access the properties of the object instead of converting it to JSON. So first thing to do is to remove `generate JSON from object`.

Next, you can use `get object properties of` with the app variable vListaFireDB as the input to the list viewer Lasta\_Finalizer which will give you a list of timestamps you have in your database.

This is just for you to see that it is working. What you should do is use it in a loop to go through each timestamp and get the property `consomo` and add it to a running sum or any kind of variable. This way you get the total of each QR code.

---

<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 25, 2021, 8:04pm UTC](https://community.thunkable.com/t/receive-data-from-firebase-to-sum/1307180/5 "2021-05-25T20:04:42Z")

</div>

@ccosta

I used the JSON text you provided and made this block to get the sum. I used a label to provide the QR code and therefore my code is this

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

It brings the following results

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

Hope you’ll find it helpful.

---

<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/receive-data-from-firebase-to-sum/1307180/6 "2024-11-08T13:22:22Z")

</div>


