Forum Documentation Showcase Pricing Learn more

Search for things with field list if things intersects. with another list of things

This seems straightforward but doesn’t seem possible?

List A: a list of things with one field that has a list of tags
List B: a single thing with a list of tags
Output: list A things where the any one of its tags are also in the tags in List B.

Seems simple in most programming languages, e.g. for i in l1, if i.tag in l2, keep i. But in Bubble that seems not possible?

You may be correct. (Depends on your exact use case.)

You’re looking for :contains. You might also have to use the “Advanced” condition to :filter a list of Things by the criteria “this Thing’s field-of-some-type :contains some-list-of-things-of-that-same-type”.

Such expressions can be difficult to build and are not possible in all cases. And, when possible, are not always particularly performant.

Bubble is array-oriented but (simultaneously) frowns on explicit iteration. Your own description of the problem says, “Hey, all I wanna do is iterate over some list.” But this is explicitly impossible in Bubble. THERE IS NO ‘FOR’ LOOP IN (vanilla) BUBBLE.

There is, in fact, NO type of loop in vanilla Bubble EXCEPT for the implicit map-filter operation implied by the Advanced :filter parameter.

You can do this type of map-filtering using my List Shifter plugin (using the PROCESS List action), or by writing the correct Advanced filter operation in vanilla Bubble.