Refresh text for a dynamic timer

Hi!

I’m trying to display a text that has the following dynamic text:
image

It should display something like:

  • (7 seconds ago)
  • (8 seconds ago)
  • (9 seconds ago)
  • etc…

This is within a repeating group, but I can isolate it into a new Reusable Element, if need be.

I cannot really find a way to do that, as…

  • The Current date/time is static and has the value of page load.
  • The result of the search is also static (and should never change anyway).

So, the problem is that the “now” is wrongly static when it should be dynamic.

I tried to find a way around that with workflows. Also with conditionals. But so far, nothing.

As an example, the (deprecated) plugin Efactive correctly feeds a new value every N ms (settings). This shows that it should be doable.

I’d like to think that Bubble can do such a thing without a plugin though.

Any idea?

Sam

I finally found a way!

First, I had to create a Reusable for my repeating group entry. Else, I could not access the Text element itself in the Workflows.

Then I created a “When” WF, ran every 1 second. Inside, I set a state of the Text element to the computed value. I created a state called “elapsed time” (number). In this WF, Current date/time is no longer static but dynamic. I find it counterintuitive that the same function is treated so differently in these 2 contexts.

Finally, I set its value to evaluate to its internal state. Whenever the state is updated, it redraws the element.


image

Hopefully, it helps other people.

Sam

This topic was automatically closed after 70 days. New replies are no longer allowed.