How do you sort the users who subscribe to my database via FirebaseDB in a "listview"?

Hi everyone, I'm programming this app of mine, which I need to download all the data contained in my firebase database into a list, each user fills in the data via the registration form on my site (name email number [time and date automatically taken from the site]) I would like this data to be at least sorted in chronological order, but currently when my app downloads the content in the listview everything is completely random... there isn't even a descending order like on the FB server ... Below I attach the screen of the main code, please help me, thank you very much, I would be grateful

You have some list blocks to sort lists:


the problem is that I have to reset the list every time the clock is updated (every 10 seconds) because otherwise it clogs up the listview... Consequently if I go to sort it it doesn't do so between users, but between the data categories of each individual subscriber

The other problem is that you are making 5 calls to firebase for each user, which is very inefficient.

Make one call, return all the users as a json, get the values from the json to populate your listview, it only takes a second or two.

Why ?

Why not ?

In addition to @TimAI2's advice to get the whole tree in one gulp (tag = empty?),

show us how you format and store the registration date and time.

If improperly formatted, that could thwart future sort attempts, i.e. 'August' < 'February'.

but in my db, each user returns 5 data to my database, how can I get all 5 values ​​through a single call?

i take it like this example:13-02-24

I was afraid of that.

External formats that please the eye but aggravate sorting. The major part (yy) is at the end, a useless place to put it.

The Clock component has a wonderful SystemTime block that returns a big number for a moment in time, just perfect for sorting. Use that for a combined registration datetime mS attribute, and format for display only at the last moment, after sorting and selection, when building Elements.

Call the GetValue of "elemento" instead of "elemento/mail", "elemento/phone"...then with all data you can search phone, email...

Sorry, I think I understand how to do it, but I need some clarification, I don't understand why in my database each recording is sorted in descending order, but when you download the data to my app everything appears out of phase... .
my idea is to reverse the list and put it in ascending order when I download the data... so as to have everything in chronological order.
This will solve all my problems, but I would like to understand where the problem lies
Immagine 2024-02-13 180248
Immagine 2024-02-13 180743

come you can see, in the list in position 1, what actually on firebase is in position 1 does not appear) I would like to solve this thing

Neither firebase or json tend to sort things in the way you would expect.

You will have to perform a sort, based upon your criteria, on receipt of the query output.

and how i can do It? can u give me some example?

You have been shown the sorting blocks above...

If you mean parsing the json, then please provide your output here as TEXT (not an image) and someone will show you how.

I've never used those sorting blocks, I don't know if they could help me...
now my situation is the following:

I now have the complete list of registered users, with a related timestamp,
Now logically it occurs to me to think of a resolution similar to this: shortly I will insert into the registration form on the site a value that marks the time in milliseconds that have passed from 2023 to today, in such a way as to have a more precise and efficient timestamp in milliseconds. then somehow make the comparison between user1-user2-user3 etc... except that I don't have the slightest idea how you can do something like that.
Is it possible that those blocks listed above can help me? If you need the Aia file and could help me from this point of view, you would be doing me a truly enormous favor

They will sort your data in chronological order if you sort by date, and you have your date in an alpha-numeric format.

If you store your user created timestamp as milliseconds then it is simple maths to subtract one from another to find the time difference. (firebase has a timestamp value function you can call)

Example (fireabse rules set to read and write = true):

This is used to create users:

Firebase Console:


This is used to return the user data and sort it by timestamp:

You can do more formatting to improve listview layout and convert the timestamp to human readable date and time.

Did you know that the automatic node (tag) names created are also based on a timestamp and are alpha-numerically sortable (first in list (a-z sort) would be earliest in time)