Search for list items since last login seems weirdly hard

I wanted to include news in my app. So I added a news item and wanted a 'search for newsitem" constraint Created date > lastlogindate: (last item - 1) (because otherwise the search is for news created since they logged in). Can’t be done!

Considered adding the logindate only when the user logged out. But they might not and if they do how would bubble know who the current user is any more?

Any clever people out there with ideas?

@peter Just so I’m clear, “lastlogindate” is a custom field you’ve added to the User type and are updating with workflows, right? If not, you’ll need to add that field as there is no system field exposed that logs this information. Assuming that’s in place:

Option 1: add a list field of type user to the newsitem data type (eg “seen_by”).

  • Depending on how your app works, set up a workflow to add current user to the newsitem’s seen_by List of Users when the newsitem is clicked/shown, or on page load–whatever signifies that the current user has engaged with the given newsitem. Use this logic in search constraints to only show newsitems where user is not in that item’s seen_by list.

Option 2: add a date field to the newsitem data type (eg “date_published”).

  • Combined with the lastlogindate, use logic in searches to only show newsitems where item’s date_published > current user’s lastlogindate. If you’re concerned that users never log out, consider adding a page load event to each page to nudge the lastlogindate whenever the user navigates to a new page (proxy for being active in your app). So, something like When Page is Loaded–>Make Changes to Current User–>lastlogindate=current day/time.
1 Like

Thanks for replying.

Option 2 won’t work because the lastlogin date will be set at login. So if a news item is created yesterday then it is after the last logindate (today). I guess this draws attention to the fact there is no way to identify the last item but one (penultimate item) as you would in a normal array. If you could do a spreadsheet style construction like "Item #( :last item -1) it would be much easier. But you can’t.

Option 1 should work. Thanks for that.

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