How to update API without click?

Hello everybody. I am creating an app with updated information on cryptocurrencies. I have successfully imported the data via API but the update, for example the Bitcoin price, takes place only via click … how can I do to have the price updated automatically without clicking?

Hi Jenny,

Welcome to the Adalo forum!

You could use the timer component! Have it countdown on the page on a set frequency to get your API updates.

2 Likes

Hey @Erik!
I guess that’s partially solving the problem, I guess she wants to have the price updated in the same page, more than once…
Here comes my solution, that builds on top of Erik…

Add another action to the countdown: go to screen “A”.
In the screen “A” there is a action when you visit the screen: “go back”…

And you are in a beautiful loops where the speed is determined by the countdown, and the price keeps getting updated.

Might do a video on this, thanks for inspiration!

2 Likes

thanks Erik and Montetennis… yes I tried, it works but the effect is not very pleasant because the user would see the “page reload”. I was thinking if there was a way to automatically reactivate the countdown on the same page … in this way if it would restart automatically I can apply an update action every time the cowntdown goes to zero … how can I reactivate it every time it goes to zero?

There is no way. However, be sure to set the blank screen which looks exactly equal to the current screen, and that the transition is none. The “page reload” will disappear.

1 Like

@montetennis correct me if this wouldn’t work, but couldn’t you loop on the same screen with a change input, like below?

Haven’t tested it, but could work

3 Likes

@Erik This might work as well, and looks better.
Honestly I don’t know if the “countdown ends action” is triggered only the first time it reaches 0, or can be resetted by adding seconds to the countdown…

@jenny try this and let us know if this works. :slight_smile:

Doesn’t work.

Another idea is to go to a clear modal screen with an action to go back. User wouldn’t be able to use the screen for a second, but they wouldn’t see any transition and would “remain” on the same screen.

2 Likes

Thanks @jenny for this question…
I guess @erik and I learnt a new trick here! :slight_smile:

1 Like

thanks to you for all the help now i’m working on “discounting a product for a period of time” but with your help i think i can. thank you again.

hi guys, as I told you a little while ago I’m trying to perform a price update on a product. This update will be a discount of 20% but only for 48 hours. I managed to do the whole procedure but if the user exits the page or logs out, the countdown does not continue. I cannot apply the cowntdown in the database so that even if the users log off, time continues to run. how to do?

For that a countdown is not appropriate. You need to set a date field “discount end”, and when you were making the countdown start, this time you created this date to be equal to NOW + 2 (days).

Then you apply the discount based on the current time, and the time displayed in this field

I’m trying, but your reasoning is not clear to me … can you show me some examples?

hi @montetennis , I have tried various ways but I cannot apply this product price discount and reset factor. please can you show me the correct procedure. thank you

@jenny I believe I might have to check your structure, and create an example on your application. Unfortunately this could require some time. Hopefully someone else can answer this question, or you can ask for professional help on the expert page!