Custom Filter Option Unavailable when Using Many to Many

Goal: I want to be able to filter a list of “Points of Interest” by a “Designation Name” when it’s possible for a point of interest to have many designations and a designation to have many points of interest.

Currently I have the functionality working when a Point of Interest has only 1 Designation name and Designations has multiple Points of Interest.

Current Setup Details (I’m not listing all collections and details just those I feel relevant)

  • Collections

    • Designations
      • Has multiple points of interest
    • Points of Interest
      • Has only one designation
  • Screens and Components

    • (Screen) Home
      • (Component) Avatar List
        • “What’s this a list of?” → Designations
        • Filter → All Designations
        • Links to Points of Interest List Screen when clicked
    • (Screen) Points of Interest
      • (Component) Text Input box
        • Default Value → Magic Text → Designation Name
      • (Component) Simple List
        • “What is this a list of?” → Points of Interest
        • Filter → All Points of Interest
          • Custom Filter Current
            • First Parameter = Current PointsofInterest > Designation > DesigName
            • Second Parameter = Contains
            • Thirds Parameter = Other Components → POI List Text Input

Use Case

[SUCCESS] Click on Designation on home screen, navigates to Points of Interest and populates the text input with the Designation selected from home and the Simple list just has the points of interest tied to the Designation. Great!!!

However, when I switch relationship between Points of Interest and Designations to Many to Many, because a point of interest can have many designations and a designation can have many points of interest, I’m limited on selectable options on a custom filter and lose the ability to choose Designation Name.

(see below example for custom filter functionality AFTER I switch to Many to Many)

  • First Parameter
    • Current PointsofInterest > Designation with a choice of either “All” or “Count” are my only options :frowning:
  • Third Parameter
    • “Other Components” doesn’t even show up if I choose “All” for Parameter 1 of Custom Filter and if I chose “count” it does show up but that doesn’t really make sense

What’s the best way either through collection design or some other fancy technique be able to achieve my Goal at the top of this post?

Thank you in advance!

Clearly you cannot populate a single textbox component with a multi related data. So turn the textbox into a list and enter as the maximum number 1, as a filter set the user-related designations, something like Name - Equal to

Although I appreciate you responding to my post, I’m not sure your recommended solution addresses my problem. The issue does not appear to be with the text input box. That works perfectly and carries over the designation name when selected on the home screen from the user with the many to many scenario. The issue lays with the simple list component losing filter options to refer to the text input box and the filtering option to choose design name in relation to current points of interest. Unless I’m missing something in your explanation?

Sorry, now i understand. Probably your data is not properly linked. Could be useful to have some screenshots of the issue

Eugen,

Image 1 is the filter option I need when I have the relationship of many points of interest to one designation.

When I switch to a many to many relationship, I lose that option for the custom filter as you see in image 2.

An option I found in this forum post ( Not able to use many to many relation to filter in a list - Get Help / Database - Adalo) was to add a search index to my points of interest collection in which I add Designation Name and anything else I want to search by to the index column and using that in my filter. However, I’m looking for other options if possible.

Thank you,

The “Current Designation” should be available in the screen’s data, if you’ve linked through a list of “designations”, and will be available as a filter parameter.

The filter will be:

[ Designations > All ] [ contains] [ “Current Designation”]

I’ll add that you should make sure that your screen shows “Current Designation” in the Linked Data. Like has been said, if your data linking is broken due to cross-linking, circular linking, etc, that “Current Designation” may not show up. I had a lot of trouble with breaking the data passing when I first started building my apps, because I didn’t understand the limited way Adalo handles it. You have to think very “linearly” when passing data, and be careful not to use the same screen to receive multiple links. i.e., if there are multiple areas in your app where you might link to a details screen for your destinations, you have to be really careful what data ends up on those out-linking screens and what data gets passed to them or it can break the data on the details page.

I do have “Current Designation” as “Linked Data” for the Points of Interest screen. I also can take your suggestion on a filter which is great for when the user is navigating from the home screen by clicking on a designation name.

Designation Linked Data

However, per the write up, my rub is that all my other list filters focus on using the component Text Input Box which is essentially a list search on the screen. I can populate the Designation Name in the Text Input Box there because of the linked data. However, if I use your filter suggestion the list doesn’t take its direction from the Text Input box where the user can then change their search term at any point in time. so rather than [Designations > All] [contains] [“Current Designation”] I need to do [Designations > All] [contains] [text input]. It won’t give me an option of [text input] as depicted in the images below which got removed as an option when I changed the relationship to Many to Many.

here is the option I need from a filter using another collection

Here you can see when I use designations with many to many relationship to points of interest it doesn’t allow me “Other Components” option to chose text input on my screen :frowning:

I see, so after you’ve navigated to the screen, you want to be able to change the designation without going “Back” and selecting a different one…

How about, instead of using a text box input, you use a dropdown. Set the dropdown to “Designations” (display “Designation Name” in the dropdown), and then have the default value be “Current Designation”

Then, I think your on-screen list filter should be able to find the dropdown… Set it to [Designation] [Includes] [dropdown > Selected Designation].

I don’t have time to test this right now but since I chimed in, I didn’t want to leave you hanging. Hopefully I’m not mistaken, but give it a go.

1 Like

I appreciate the feedback and not leaving me hanging :slight_smile: . However, the drop down isn’t going to work. It’s a specific list of values when I need ANY search term the user may put in and then my list to reflect that search term being a designation name OR a point of interest name OR a Point of interest description OR a taxonomy type OR etc… Hence the use of the text input box which gets populated either by a selection from previous screen or a typed in search term.

Seems I’m still stuck at the fact that one collection, Designations, I won’t be able to filter the Points of Interest list by unless I change the relationship type OR I add the designation value in a SearchIndex field in the Points of Interest collection OR i consider that the Designations collection is a “property / adjective” of my points of interest and I maybe get rid of that collection and make it a field in the points of interest collection.

I think an intermediary collection might be a workaround…

Create a collection named like “PointDesignationPairs” with 2 relationship fields that are 1-M. Get rid of the M-M relationship between Point & Designations, and replace it with relationships to records created in the intermediary collection.

Of course, you’ll need to be creative and really understand how to set up your screen’s and action’s data availability in order to create the intermediary record when “adding” designations to “points”. I do this with a collection I call “Pay Stubs”, which is an intermediary collection between “Users” and “PayrollRuns”, but I use it to log additional data that is associated only with that singular relationship between Users and PayrollRuns. You could add a data field, like “designationRelevance”, that could be like a 1-5 rating on how strongly the designation matches the point, and use that for additional search/filter options. Like, “show points of interest that have a 4 or higher relevancy score for designationX”

1 Like

I played around with this creating a new collection and then setup the following relationships:

PointsOfInterest < - PointDesignationPairs [1 : *]
Designations < - PointDesignationPairs [1 : *]

After setup, it seems I run into the same type of issue where I can’t get the Text Input Box on the screen to be an option to include in the last part of my filter statement for the list. It seems that the filter doesn’t allow for the Text Input Box as a selection when it recognizes you’re referring to the many side of a relationship for the lookup value. (I confirmed this when I switched the first relationship from [1 : ] to [ : 1] as the option became available but this doesn’t make sense for my data.

Correct me if I misunderstood your guidance and thanks again for brainstorming.

Today I experimented with having MULTIPLE (3 to be exact) relationships between the same two tables: Points of Interest and Designation with many to 1 [* : 1] setup. As a result, I now get the filter option i’m looking for including the text input. However, If I add say 3 relationships calling it Designation1, Designation2, Designation3 in the POI collection, I then start to substantially increase the filters I need to add to cover the text input value being in Designation1 OR Designiation2 OR Designation3. It’s a solution but I’m now trying to decide if I like the search index option better but not sure where else the many side relationship may be limited if I go back to that. Onward to see what happens as I add more :slight_smile:

ah, I see now better what you were trying. Unfortunately I guess you just can’t do it that way. You’ve got to have a record data available to search in MM fields, and text inputs do not provide that data.

Good luck on finding a workaround! :wink:

1 Like

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