How to find closest generic time to now?

Hi - I am trying to match a list of numbers in a repeating group to what time it is now.

So for instance the repeating group has 1:00, 1:15, 1:30… etc.

How can I find the closest matching repeating group time to now rounding down?

You can do it. The idea is to get the whole time differences, find the absolute minimum, and highlight the cell with this minimum. Maybe there is an easier way, and I would love to learn it. But below are the actual steps for my solution:

• Calculated all time differences between the Current Cell’s time and now:
• Get the list:
• Get absolute values:
• Find the minimum:
• Do the above calculation in a custom state (so you don’t do it over and over again):
• Conditionally change background color of the text in a repeating group if absolute value of the difference between Current Cell’s time and now is the minimum (which means closest to the now).

Things to keep in mind:

• Of course, it is not dynamic. Because `Current Date/time` is not dynamic, meaning that it needs refresh to show the correct highlight. Below is a demo for when refreshed. See how it highlights the closest one when refreshed:
• Finding the absolute value required some trick as you see. Simply, you check a condition `>0` and `format as text`. Then, you can calculate absolute value yourself as in the figure that says `boolean formatting` above.

Here is the full editor if you want to check yourself: Tests for Forum 10 | Bubble Editor

1 Like

Awesome!

1 Like