After spending a day working on this and searching the forum for a solution I haven’t been able to figure out this calculation yet:
I have a countdown that is 604,800 seconds long (don’t worry, not using workflow calls) and I need my progress bar to count up to 100% to show that the time is up… does anyone know how I could set this up in the percentage box?
Have you tried dividing the current number of seconds by the total number of seconds in your countdown? This would yield a percentage that could be displayed in a progress bar.
Yeah, when I do that the progress bar does this weird thing where it irregularly moves around back an forth… no idea why. I know this has to be possible, just a matter of finding the right calculation…
In my database I have created a product with a set expiration date.
Then I have set conditions on a text element to change when certain milestones are reached. Here is the formula: Product Expiration Date - Current time = Time Left. Time Left is obviously what I want to display. (I have added a lot of formatting so its easy for my visitors to read) here are my conditions:
If you didn’t catch it my countdown essentially does this:
6 Days, 5 Days 4 Days 3 Days 2 Days, 1 Day, 24 Hours, 23 Hours… all the way to 1 Second then displays “CAMPAIGN HAS ENDED”
Wow. Impressive.
I’ve ran into limitations with the progress bar plugin myself and have resorted to using the HTML element to display a custom progress bar. I found one online that is just a CSS3 animation. What’s nice is you can still insert bubble variables or fields from your DB (Dynamic Text) into the html/css code.
I wonder if you just inserted your percentage calculation into an html element if it would work for you. Pretty simple just insert the dynamic text into the css everywhere it says { width: 55% } (multiple times for browser compatibility). Just replace the 55 with your dynamic text field and leave the %
You’ll need two numbers; the total duration, and either remaining time or completed time.
completed / total * 100 gives % completed
total - remaining / total * 100 gives % completed
(Bubble’s operators go from left to right)
You can then add floor or round to discard the fractional component.
The workflow action could store time remaining in seconds, instead of the current time, then your conditional expressions would be simpler.
Likely due to its dynamic expression being re-evaluated. You’ll probably get this on a HTML element too if you put the expression into the same HTML that defines the control. A way to prevent this is to have the HTML element define an “updater” function, and another HTML element or “Run Javascript” from the workflow to send it the new value.