Retrieving Data from firebase with changing buckets

Hello, I have actually been trying to retrieve from my firebase database .But the problem is ive been unable to retrieve it after 1000 tries.The first bucket is constant and does not change which is users bucket and the second bucket is the userid obtained from logging in , the third bucket is the readings and the last bucket is the continuously changing timestamp. Ive been trying to receive the data under timestamp but have been unable to .
I would be really grateful if anyone helps me out.


should return 0

If you set your Bucket to .../readings and do a GetTagList, that should give you a list of the timestamps used as tags.

From that list, you can issue individual requests tag by tag to get (I am not sure) either dictionaries or JSON strings with whatever readings are under that timestamp.

I am not trying to get value of timestamp, i am trying to get value under the timestamp

I’ll surely try this and will get back to you ,really appreciate the reply .Thanks

Which is exactly what I suggested. For readings "0" the value for/under timestamp is "0". For readings "1681039720" the value for/under timestamp is "1681039720"

Yeah but in the block you sent , you have specified the tag which is 0 whereas in the app the timestamp is continuously changing so the values of the data would also change .

So if i follow your block , ill get data of only 0 timestamp not other timestamps.Whereas i am looking for a block which would work for all timestamps.



If the tags below readings are going to be equivalent to the timestamp value,as they show in your data, then all you need to do is return a taglist for project bucket readings. This will return a list of all your timestamps.

Can you send me a sample of block , im actually bit new for this , I’ll be really grateful for this

OK, on review of your data the tags do not actually match the timestamps, so we will need a different approach. I have replicated some sample data to seek to match your data structure.

I have assumed that your UsersData tag is directly below your root project, and that you wish to return the timestamps for each entry (abc,def etc.) for a single user (FhUQZ-Vu2)

In the designer my Firebase settings look like this:

Note the projectBucket is set to "UsersData"

We probably want to minimise the number of calls we make to Firebase to retrieve data, so it makes sense to call back all the data under "readings" for our single user (FhUQZ-Vu2).

We can do this with a getValue call like this:

Note how I join the "user" tag with the "/readings" tag, and remember that the projectBucket is set to UsersData. ( You can use a similar getValue call to return all the users, which can be put in a list for such use)

Now we need to handle the data retrieval, which will be a return of everything under readings for the user, in the form of a json. This I have shown in a label, and stored in a variable. We then "walk the path at every level" in the json to return the timestamp values, and put these in a list. I have shown these in a listview. I also display the user variable.

Screen Output:


I really appreciate the reply. I created another firebase database just like your and tried to implement it but all i am getting is an empty brackets .Can you check it and tell me if where is the problem?





Oh okayyy , i solved it .Thanks i really really appreciate it.
I have an another question though , we displayed like the whole list but what if i need only the latest data .
Like from the above example ,the list of timestamps was displayed so what if i need only the latest timestamp only

Something like this:

1 Like

Oh that worked like brilliantly , you have literally saved my life.
Btw i have one last question if you dont mind,
My data is continuously changing , so if i was able to get data like changing on its own and displaying it without the use of get data button.How would i do it?

Example:Like the what you taught me earlier about the how to receive the timestamp with just a single click using get timestamps button.So what if i were to get continuously changing timestamps on its own without clicking the button.
Like in the box , the data first was 169970988 and after the new data was received from
Firebase it was replaced by 1687789790

You could place the getValue block inside the dataChanged event.

Try this see how it works

Okayyy , lemme try and ill get back to you.Thanks in advance

The alternative is to use a clock timer to return the latest timestamp at regular intervals, although this may mean you will miss some out....

I had tried the clock timer previously but i was unable to receive data via that method

I tried this but i am getting the value of like jkl timestamp which is 30 and not lmo timestamp which is 27. Can you tell me my mistake?