How to execute a task only once per day, regardless of how much times the app is opened after the task?

Hi all! :wave:

I have a task to do, let’s say, update a stored value, only once a day. So,

  • If the user opens the app for the first time for the day, the task must execute.
  • If the user opens the app again the same day, the task must not execute, as it’s already done for the day.
  • If the user opens the app some other day (tomorrow/later), the task must execute for the day.

So, the app would update the value once per day the app is opened, and I would use the updated value later inside the app for the rest of the day.

Is this possible to do? I have tried with a rough idea, but It seems the blocks I made are wrong :slightly_frowning_face:


I would really appreciate any help/advice :smiley_cat:
Thanks! :+1:

Hi,

The user registers in Fiirebase and after if the date value in the database does not match the current date completing the task and save date in the base.

No, everything is made easier by using the stored variable.

2 Likes

Hi @actech! Thanks a lot for your quick reply! :smiley_cat:

Your idea seems great, I’ll surely try this out.


Actually I am using Local Storage for most of my app-tasks, and would see if your idea works with Local Storage too. Also, that task which I am talking about would be updating a localDB data source from Airtable.

So, my final idea is to update the local Data Source only once-a-day on the splash screen, for the rest of the day’s sessions.

Thanks! :smiley_cat:

Launch applications.

If store == null or store != currentDate then {

make tasks and save date in the store

}

2 Likes

Thanks for sharing the workflow! :smiley_cat:

I am currently trying your idea. :+1:

I would use the seconds since 1970 block in a stored variable.

If storedTime > 84600
Do task
Else If storedTime < 86400
Display alert “too soon”

1 Like

I used day month and date to make unique ID of each day… And used this as tag… Aloso added VC { Visit Count } as suffix, And used it asa tag were i count and store the visit/no-of-time-a-user-open-app-after-task. :sweat_smile: Hope this will work too…


Ct tricks

3 Likes

Thanks @cttricks! Beautiful Idea :+1:

btw by date, I meant dd/mm/yyyy only :slight_smile:

Thanks again! :smiley_cat:

1 Like

Update : @actech your solution has worked! :smiley_cat:

Thanks a lot! :+1:


Also, If I may ask, what if I want to accomplish that task weekly?

Thanks! :smiley_cat:

In this case, the easiest way is to use a block with milliseconds.

IF (store == null ) or (store > getMillisecons + millisecondscountforweek) then {
store = getMillisecons
maketask
}

2 Likes