Listening for data changed and trigger events

Hello guys.
I’m implementing the Todo List app.
There is data type ‘Todo’, which contains fields ‘finished’(type: yes or no), ‘dateToDo’(type: Date).
I want to turn on a pop-up UI when the following conditions are satisfied.

  • All of the tasks that is assigned to today are finished

So I thought that it can be possible, when count of todos that satisfy the condition ‘finished = no & dateToDo = today’ is 0, turn on the popup.

My custom event gets a number as parameter now.

I tried to ‘Trigger custom event when data changes’ in page loaded.
I hope to set the todos that satisfy ‘Do search for’ - Todo - ‘Created by = current user’, ‘dateToDo = current date’, ‘finished = no’ and set listener to watch the count of the todos.
But the ‘field to watch’ has no option because the thing to watch is count, just number.
Is there anyway to acheive what I want? Thank you.

For the popup to appear the user must be logged into a session and be looking at the screen

This might happen when a user is not logged in or not looking at the screen

You might want to consider having an email sent to indicate the status of all jobs is complete, or have in app notifications, so that when the user logs in they will see a notification to click on which will let them know all tasks are completed.

In regards to the database trigger changes, you will not be able to use those as they listen for single database entry changes, not multiple entries (although, yes, listening to changes for all, but on front end those are specific to a single entry that you specify, while on backend they are for all entries but you need to set conditionals to isolate which changes trigger the actions and are usually done in such a way that it is triggering only for a single entry).

As mentioned, I think ditching the popup idea and using an email or in app notifications.

In regards to data structure you can have a data type that has fields that are a list of ‘todo’ plus field of date. Then you can put together a backend database trigger change listening for this data type with conditionals that are 'when date field is current date/time (these both need to be formatted as text usually best is the 2/24/24 format but most formats are fine since you only need to evaluate that the text is the same - formatting dates changes them into text) and that list of todos status is complete.

I’m not 100% sure if the database trigger change will allow for a condition to evaluate on the related fields fields (ie: the todos status) but they should.

Thanks, @boston85719
One thing that I didn’t detail is, the condition( * All of the tasks that is assigned to today are finished) should be checked when user click ‘done’ button of each task. Done button like every todo-list app has.
But I could’t find the method to open popup by done button, because the done button is in separated reusable component(todo item UI), and it seems impossible to open popup which is located in higher layer.
The structure is like this.
|… … … … …|
todo list popup
todo item(reusable component) - done button
Anyway, so it is hard to replace this feature to sending email or notification. Because it is intended to show the popup when user completed his tasks and click the done button of the last thing of his schedule.

So I tried to detect changing of data. I should try more to make nice condition statement… but in this structures it seems impossible to specify ‘field to watch’

If all you want to do is show a popup when the user clicks the done button, just on the same action trigger for when the done button is clicked use an action to show the popup.

The done button is in the reusable component, so I can’t find that how to control to show popup of upper layer. (There is no my popup in the list for showing. The following image is When ‘Button done is click’ → ‘show an element’ in reusable component’s workflow)

I think it is unable to detect the internal event in reusable element from higher level. anyway it is reasonable because component should be independant…
It would be better if I can inject some event handler in reusable element, but I can’t find it.

put the popup into the reusable element that the done button is in

Okay, it seems possible to show popup by condition(using ‘only when’).
It’s not the way I initially expected, but I think the problem has just been solved. Thanks!

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