Hello Bubble Community,

I have two data types in my database that both contain a list of texts (Codes), and I need to identify matching items between them.

Data Structure:

Data Type 1 (Reference Table)

Codes (List of texts)
ID (Text)

Data Type 2 (Daily Records)

Codes (List of texts)
Date (Date)

Goal:

I need to check which Codes from Data Type 2 (for a specific date) match Codes from Data Type 1 (for a specific ID) and flag those rows for additional workflows.

Current Workflow (Not Efficient)

I am using the following backend workflow, but it feels inefficient and might not be scalable:

Search Logic:

Do a search for Data Type 2 where Date = yesterday
Each item’s Codes INTERSECT with
Do a search for Data Type 1 where ID = “1”
Each item’s Codes: count > 0

Problem:

Performance concerns when dealing with large datasets.
Unclear if Bubble is handling the list comparison efficiently.
Struggling to “flag” the matched rows for further actions.

What I Need Help With:

Is this the best way to compare lists across two data types in Bubble?
How can I flag the matching rows in Data Type 2 for future workflows?

Any guidance, alternative approaches, or best practices would be greatly appreciated!

Thank you in advance for your help.