How to get index in list based on time?

hi, i have searched for a similar topic but i didn’t get any solution.

what I want is when the clock shows 19:35 it will automatically get index 2, when the clock shows 20:56 it will get index 3, and so on.

so that it still gets the index even though the time does not match the value in the list.

Maybe that …
Did you try to compare if the time is greater than 19:24 and less or equal than 20:30 … index = 2?

If > 20:30 And <= 21:25 index = 3
If > 21:25 And <= 22:17 index = 4…

1 Like

thank you
is it possible if I manage the list on a custom basis every day?

Did you try https://docs.kodular.io/assets/images/blocks/text/compare.gif

1 Like

hi @ibnudjamil33
I’ve solved your problem, this way.

design

blocks

aia = Index_time.aia (6.1 KB)

hope this helps you mas broh

3 Likes

Tengkyu mas broh

I want to custom set the length of the list, sometimes the list length is 50, sometimes 20, it changes every day.
whether your block will solve this problem.
The list length in the question is only 5, but that’s just an example.

is it possible to dynamically create blocks.???

I think it’s possible. add times to the list and change the procedure. I’m sure you will get the index

What do you want to do if clock is 23:31

  1. use index 1
  2. nothing
1 Like

Nothing nothing

Try this one indexinlistbasedontime.aia (3.9 KB)

4 Likes

thank you @sugarlesscreator and @Boban
your answers have helped my project 80%
nice to be here.
I will develop, to get 100%

1 Like

Another workaround is to convert them to milliseconds and compare them using math blocks and loops.

3 Likes

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