So I am trying to figure out how to Count the number of times HAVEIT = true and then display the count. So far I am not having much luck… Can anyone point me in the right direction?
To get the value of a node, you must correctly specify the full path to this node. You have an incomplete path. How to find out the full path? In the Firebase console, open the node you need and see the full path to it, which will appear in the line above the data area.
So I’ve got the right path to my node. Now how can I get the count of how many times the word TRUE appears?
See blocks for working with objects. They have a block to get a list of all the child nodes. Make a loop on this list and count the number of true values.
I’m not sure where I’m going wrong,
#1.
As I understand it, this should list my 3 results from my database.
However I am not getting any results when I test it…
I can’t even get them to display, nevermind trying to count them.
You need to use the “get object from JSON” block, and not the “generate JSON from object” block.
I feel like I’m so close tonight. I’m just missing something…
So far it is returning 0, I believe it should be returning 3…
Hi.
You have the solution in this video: https://www.youtube.com/watch?v=QmkuI7iomlU
You are using a block “generate JSON from object” for a list of objects. It is not right. “value” block already contains a list of objects, and it needs to be connected directly. Do you understand this?
for my data
I have changed my blocks as you have suggested, however my project returns nothing…
If I am doing something wrong, I cannot see it. My project is located here: Thunkable
If I read your posts correctly then I believe that the value of the "HAVEIT"
property will be the Logic value true
or false
, not the Text value "true"
or "false"
.
Hope this helps.
-Mark
You’re right. For this reason, before the block get property HAVEIT
to insert a block join
to convert a logical true in the string “true” to add it in ListViewer, and in block if
instead of the block “true” use true
block.
Thank you very much guys. It worked. This thread is closed!