List filtering by OR conditions

Hey Gang - I’d like to display a list of Announcements for each User.
For each User, they see Announcements where,

  • User.section contains Announcement.section OR
  • User.site contains Announcement.site OR
  • User.resource contains Announcement.resource

My use case: Students are subscribed to sections, sites, and.or resources. When a staffer makes an announcement (or event), the announcement can take a section, site, and/or resource relationship. I’d like the students to see a single list.

How might I do this?

1 Like

I would need to know more about the specific use case, but off the top of my head, with the information given I would say creating a custom component would be the easiest way (if you have a little React experience).

I would create 5 database collections

  • Users
  • Sites
  • Sections
  • Resources
  • Announcements

Users and Announcements would have a many-many relationship with Sites, Sections, and Resources.

Then I would create a custom component called ‘Announcements’ or something like that that takes in 3 lists.

from manifest.json
"props": [
    {
      "name": "sectionAnnoucementList",
      "displayName": "Section Announcements",
      "type": "list"
    },
    {
      "name": "siteAnnoucementList",
      "displayName": "Site Announcements",
      "type": "list"
    },
    {
      "name": "resourceAnnoucementList",
      "displayName": "Resource Announcements",
      "type": "list"
    }
  ]

Then add the current logged in user section, resources, and site announcements to the custom components and merge them into a single list to display.

1 Like

@TKOTC Thanks for the reply. I don’t currently know React but plan to change that! :slight_smile:
I do have those tables you recommended. I suppose if this was using external collections in xano, the function stack would be straightforward to make.
I guess we can’t currently do this using Adalo’s internal collections.

FYI my use case detail: It’s a school app. A student may get events or announcements for the classes they’re enrolled in, the physical site they attend, and the resource lists they’ve subscribed to. I hoped to have a single list, sorted by date.

If you know how to use Xano you can probably go about it in a slightly roundabout way as well. You can create an endpoint in Xano called “GetAnnouncements” that takes in a user object (which contains “Sections”, “Sites”, “Resources”). Xano can then call the Adalo database to get all the announcements related to the user and return them as a single list. Then you use the external Xano data to populate the announcements list. I think this will have some issues scaling, but would be a no-code solution.

The alternative is I, or someone, can whip up a custom component that you can publish privately to your app that will fit your use case. If this is something you would want to look at doing I can put together a public Adalo project and create the custom component to show you what it would look like near the end of the week (tomorrow or Friday), just let me know. No charge (in case you were thinking otherwise). We can go from there.

1 Like

I am having this same issue (I think) while trying to create a search bar. When I am adding additional criteria, there is no way to select if it is an AND or OR filter. As far as I can tell, it defaults to AND.

2 Likes

@TKOTC! If you made a list component, it’d certainly be helpful. Let me know if I can be helpful.

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