Hi, I would like to send notifications 2 hours before an event occurs. In this case, the event is a horse race and the event time is in a column [PT], Post Time.
The records added to the table are added anytime a day before or on the same day. The records contain data on a horse bet.
The data add event has the problem that the condition is checked just at the moment a row is added, and it is true the notification is sent.
This is my condition: AND([PT]>(TIMENOW()+2-USERTZOFFSET()/60),[Date] = TODAY())
With this condition, I have to add the records 2 hours before the race, same day. Previous rows added, won’t trigger a notification.
I can’t think of a way without using a lot of bot events and even then you couldn’t trigger it exactly 2 hours prior to the event, that would need 24*60 events
In your automation triggered by the row add event, include a Wait step with an expression that calculates the duration from the time of the row add to the time when you want the notification sent.
I was thinking something along these lines as well.
I’ve got an app that I built to help me keep track of all the details for my Friday live stream, and in that I’ve included some alerts to help keep me moving along in the script. For each segment, I can push a button to “start” that segment, which then kicks off an automation to wait for the amount of time I estimated this segment to take; when that time expires, AND the segment is still active, then a push notification is sent to me telling me to wrap things up.
As @dbaum hinted at, you’ll need some actual interaction from a person to kick off your automation.
As @SkrOYC pointed out, if you wanted to go the scheduled route (where you wouldn’t need any interaction from a person), you’d need to create a bunch of automation elements to make things work.
Based on these platform restrictions, for me it’s easier to go the route of pushing a button to kick something off.
This has the added benefit of allowing me to create the records ahead of time, giving me the chance to finalize things before they go out; then when I’m ready, I can push the “go” button and start things off.
Tried first with a wait condition and it doesn’t work. The same expression I use in a slice to show the bombs two hours before the race. I don’t understand why the notification is sent right away.
Don’t use “wait for a condition”. If nothing triggers the expression to reevaluate, then there’s no changed condition to detect. instead use “wait until a time” and for the time create an expression that results in the time you want the notification sent. For example, something like: (start time - now) + now
I think the condition is probably checked anytime the data it references (e.g., [_THISROW].[PT], [_THISROW].[Date]) is updated. Again, if nothing triggers recalculation of the row that it references, then the Wait condition expression has no updated data to reference.
As I imagine you already realized, I should have said to use Wait for a period of time with an expression like (start time - now). Sorry if I confused you!
The second condition of the IF expression is when I add the record in the period of two hours before the race. I established a wait time of 5 min because I have realized that if the notification is sent right away, the LINKTOVIEW can show a blank because works faster the notification than the record add.
I am testing this but I am confused about the subtraction of 2 hours. If it has to be like this @Steve .
IMO the usage of an VC with AppFormula to provide the wait duration could be a problem.
Please use the expression inside the “Period” of the Wait step directly