Custom filter causes list to not populate

Hi,

I’m working on creating some sort of social network with Adalo. In the app I have created an Activity screen that should house all the notifications, new and old. I want to differentiate the new and old notification so the users have a visual trigger which notifications they haven’t seen yet.

Firstly, to have this to work, I added an Update user action on the screen itself.

When the user visits the screen, the field Viewed Activity in the Users collection changes to the current time for the logged in user.

Screenshot 2021-08-17 at 09.14.53

This works as you see below in a record the Users collection.

Screenshot 2021-08-17 at 09.35.02

When a user likes or comments on a post, a record is created in another collection called Notifications. This fills in some data like the type of content, the recipient etc, but the most important field for this is the field Created Date/Time. This stores the current time at the moment a user likes a post.

This also works when I look at the record in the Notifications collection.

Going back to the Activity screen, I tried to add some filters to the old and new notification lists to make this work. Below are the filters the new notifications list.

Alas, this is where I’m starting to get my issue.

The logic is: check if the value (or date) in the Created Date/Time field (in the Notifications collection) is after the value (or date) in the Viewed Activity field. If that’s true, then this is a new notification and should be showed in that list.

If I remove the custom filter, then the list shows all the notification for that user, so there is something wrong with that custom filter, I’m afraid.

Does anybody see the issue in this? I’m breaking my head over this and can’t seem to find out why this isn’t working.

Hopefully I made myself a bit clear. I can only use 5 embedded images as a beginning user of this forum, so I can add some more screenshots in another post, if there is some more information needed.

Much appreciated!

Kr,
Jan

Anybody got some ideas about this?

Thx,
Jan

From what I’ve understood is that you have a Activity screen which has 2 lists which separates new and old activity. The problem you’re having is the New activity list is not showing.

First problem I can see is your custom filter, reason why is because you have the Viewed Activity updated on the Activity page so what’s happening is the field is being updated as soon as the user clicks on the Activity screen which means no Created Date/Time field will be ahead of this as it is already before the Viewed Activity field.

What I would suggest is add a Text box field called Status into the Notification Collection, when the user creates a notification in the status add “Unread”, then in the New Notification list in the Custom filter have Status is equal to Unread and in the Old Notification have the Status is equal to Read.

Update this status field when the user clicks into the Notification to Read, then it will move from New to Old. I can see the issue of if the user does not click into the Field then it does not update to Read and will stay within the New Notifications list, so you may have to do something to counteract this. We don’t have Cron Jobs as well so we can’t run a timer in the database to change the status after 24 hours let’s say but you can use Zapier for this which does cost money when you reach a certain threshold of the amount of times this task is done.

I hope this helps you and if there is anything else you can let me know.

Thanks

1 Like

Hi Kasimjh.

Thanks for this different approach, I managed to get it to work like this, thank you very much!

Kr,
Jan

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.