Get the 5 largest label values in order from highest to lowest in a Label

On this occasion I am making a stopwatch where I save the intervals in the firebase and I would like to obtain what was saved so that the last 5 saves are displayed

For this, the label as I save it is from smallest to largest with respect to time with microseconds, this means that it will never coincide and will be in an orderly manner from smallest to largest.
That's why I want to get the last 5 majors in a Lavel
This is the image of Firebase

image

Your tags are alpha-numeric, your data is not.

Call back all the tags/data for 2024/ABRIL.
Get it into a List if not a list already

Get a a taglist for 2024/ABRIL
Sort the tag list descending
Return the first five values from the list

Alternatively you can set an index in firebase, then query firebase, and limit 5
Firebase | Retrieving Data

Why are you storing the same data three times in each tag ?

that's how I would like to get it

image

image

I was able to obtain the labels in an orderly manner from largest to smallest

Now how do I return the first 5 values โ€‹โ€‹of the list

I want to see the content of each tag

image

blo

I had to remove the script to organize it
image

Now that you have saved the tags of the last 5 readings, you would need to loop through that list and ask Firebase for their values.

When each one of them arrives from Firebase, you will need to use both the incoming tag and value to decide where to show each value.

The Index in List block can be used to tell you the position in that sorted list of tags just arrived.

Use that index to update Labels from a list of Label components matching the order you want.

You would need generic (Any) blocks for that.

Use GetFirstNItems block from ListUtilz

I did the entire procedure satisfactorily

I was able to get the value of the first tag which is the largest

but when I try to get the value of the second tag
I get the value of the first tag, not the one that belongs to it

I attach blocks, I cannot translate it because otherwise the blocks are deleted
I'm using
"make a new ordered list of"

The problem seems to be in obtaining the red circle.
any suggestion

image

firebase
image

If it were me, I might do it like so (output list is sorted last to first):

rules
image

data
image

blocks

screen
image

OR (with indexing on in firebase rules):

rules
image

data
image

blocks

screen
image

perfect
avoid making so many blocks

I have this problem

When I start the count everything is fine, it brings me the firebase content and positions it at the top as I want

The problem is that the firebase content does not always bring it or it takes a while

first click
it starts running the gif of processing appears

second click
Subtract save and I get 00:00:09 so far everything is fine

third click
Subtract saves and, but I don't get the 00:00:15

fourth click
Subtract save and I just get the delayed 00:00:15 when I'm already at 00:00:18

fifth click
It subtracts save and it is just updated and I get the two that were missing
00:00:15 and 00:00:18 and start again with 00:00:15 which is the current one

bloks

Untitled

My guess is (because I cannot understand your blocks, and many are hidden):

image

You are expecting all your commands to happen at the same time, you need to give each part of the process some space/time to complete.

1 Like

I don't think they affect the hidden blocks but I still show them

It is working well and it obtains well, only that on some occasions it does not obtain the last saved

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.