Search a parameter that equates to a to a list of a different data type's particular field

Hi everyone,

I didn’t even know how to phrase the question for this topic so I am in some need of some serious help here.

So to keep it short and simple, I have got 3 data types structured as per below

Data Type 1 - Invoices
Invoice ID - text
Contact ID - text
Amount - Number

Data Type 2 - Contacts
Contact ID - text
Contact Group - List of Contact Groups
Name - text

Data Type 3 - Contact Groups
Contact Group ID - text
Name - text
Contacts - List of Contacts

Now I want to do a search for Invoices, if my user picks a particular group (let’s say for eg. British Clients)

How do I go about this? I tried using contains, filtered, advanced, etc. but I keep getting zero results returned when I clearly know there should be a match.

The value that the user provides me via a dropdown is a “contact group”

image

I’ve been really stumped on this for a few hours now so any guidance would be greatly appreciated!

Hi bryan,

I might change my database around slightly if I could so that Invoices also have a field type Contact. This would simplify the search

I believe the solution currently is to use. Do a search for Invoices: filtered: advanced. Dropdowns contact groups list of contacts contact IDs contains this invoices contact ID.


Want weekly Bubble tips delivered to your inbox? Check www.tiplister.com

1 Like

You, my friend are a genius! Thank you so much

Here’s a graphical solution for others who may be interested.

image

So just so I understand it, please let me know if my logic is correct

-Search for invoices: Returns a list based on the parameters specified
-Filtered: Based on the above list, return a new list based on the filter’s parameters
-Advanced (the filter parameter): Based on my example, I’m checking that a list of contact IDs intersects with the contact ID field from the list returned by my “search for invoices”

Is that correct on how it all works?

Also in regards to changing the Contact ID from text to Contact under the Invoice type, that would have been ideal, but unfortunately I receive this data from an external API, and due to the nature of how Bubble receives this data and considering time/resources it was unfeasible to do this. I explain it here in more detail - Bulk POST to API - Use Primary Field values instead of Unique IDs

that is the right logic, nice!
note if you hover over the word ContactID (one word before “contains”) Bubble will tell you “a list of ContactIDs”

1 Like