Conditionally show an element in a RG without refresh

Hi Bubblers,

I’m trying to show a ‘label’ (formatted static text element) when the time is within a set range of the cell’s ‘thing’s’ start time.

I’ve got the conditions working, and the label shows, but it requires the page to be reloaded.

I can’t do a when condition is true workflow to animate/show the element because the element sits within a cell/RG.

Has anyone overcome this or has any suggestions? Ideally natively/without additional plugins, but all advise welcome.

Thanks legends

Hi @ben.j :wave:

When you say “the time” you mean “Current Date/Time”?

Hi @rpetribu, thanks for the reply!

Yes, sorry, when Current Date / Time is within 15 minutes of the Thing’s Start Time / Date.

Condition below:

Interesting to note that when the condition is true, but I then modify the data in the table to make it false (by changing the start time +x minutes), the elements hide without requiring a refresh.

Possibly because they’re set initially to be hidden, unless the value is true… but then surely there is a way to make it show without a refresh?

@ben.j,

You are likely running into the fact that references to current date/time in conditionals like this freeze at the point of page load.

There are some plugins that address the issue but the easiest way to manage this is simply add a state of type ‘date’ to your element/page, wherever makes sense for you, and use the event run every x seconds to update that state with the current date/time.

Then have your conditional above reference this state rather than current date/time.

1 Like

I guess the main problem is, it doesn’t track Current date/time in real time. I just printed it to a text box and it doesn’t get updated. So, it won’t update your conditionals as well for the same reason.

image

And this is stuck in the screen for minutes.
image

1 Like

This is extremely helpful to know! I can’t believe I missed that / didn’t know it was a set value upon page load.

Thank you for the workaround, I’ll definitely implement that and give it a go.

Cheers!

1 Like

That’ll be why!! I had no idea that’s how Current date/time worked, so thank you for the help!