Every 5 seconds help

Hello,

I have a landing page that shows two different images that are set to be visible when custom state is either Yes or No. I am trying to use the every 5 second workflow to get the custom state to change back and forth between yes and no.

I am getting issues where the custom stage changes from Yes (showing one image) to no (showing the other image) but automatically reverts back to the first without waiting the set time.

Any ideas on how to get this to work smoothly? With smooth animation would be an extra bonus :slight_smile:

How are you changing the custom state value between yes and no?

Also, with the new pricing metric, I would stay away from any workflows that happen every so X seconds. Not that checking a custom state could use much WUs, it all adds up.

Is there a database trigger you could use instead?

EDIT: I got this backwards, DON’T use a database trigger if you can help it, DO use a Timer for custom states.

Two workflows stating

If state is yes, every 5 seconds change state to no
If state is no, every 5 seconds change state to yes

Unfortunately not. The main purpose was show each customer on a two sided market place what the site offers them on the home screen in an easy to view manner

Oooh Ok I see I see.

So what’s probably happening is you have the workflow that says, Every 5 seconds Set this custom state to Yes, or to No. Is there any conditionals besides that? Because If you have a workflow that says

Every 5 Seconds → Set this State to Yes (If Current State is No) → Set This State to No (If Current State is Yes) Then you basically have a timer that turns something on and off really quick every 5 seconds. Because If it’s No and we change it to yes, then technically it’s yes and we change it to No, make sense?

@loconft2

Custom states are client side (unless they pull from the database), so there are no WU costs involved at all to worry about here.

Aside from the initial loading of the images (assuming they come from the database), there is no WU issues with using a do every 5 seconds workflow in this case.

(database triggers do have a WU cost, so definitely don’t use those - what you’re doing here is perfectly correct, you’re just doing it wrong).

Instead, you just need to use a single workflow action, and set the custom state value to it’s current value is no:

2 Likes

Ah, Thanks for the Clarification Adam! TIL.

Edit: What Adam said is what I was getting at. If you had 2 timers going, then technically you created a very fast On/Off switch every 5 seconds.

1 Like

Awesome, thank you very much for the speedy response!! Have a great weekend, you too @bcart0v !

1 Like

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