Forum Academy Marketplace Showcase Pricing Features

:merge with, how could I merge 3 searches?

Didn’t find anything on the forum, and the manual seems to tell that we could only merge two lists of things.

Is it correct ?

I need to merge three of them.

Thank you,

Michel

That’s worst that I thought…

If my attempts are right, “:merge with” doesn’t work even with 2 lists when using it without search ? I mean, I’m using this expression, and it’s only rendering the last criteria :

image

I use merged with to combine more than one list. Have you tried to just keep adding searches using merged with and seeing what happens? Like… Search for X merged with Search for X merged with Search for X (where each search has separate and distinct constraints).

In the example you are giving, both of the lists you are merging look the same? Note that merged lists removes duplicates.

Hi, thanks for helping.

I will try this, just to see what happens, but I would really avoid using “SEARCH”, as the search is already made. That doesn’t make sense. Here, I’m using JOBS that are attached to a PROJECT (in the Datatypes relationships), so if I need to do “Search for JOBS where PROJECT = CURRENT PROJECT”, well, that’s making things against any Database good practice…

And yes the 2 conditions are different, they just don’t appear on the screen :slightly_smiling_face:

I see. One issue I ran into with “merged with” was that even though you’d think it automatically treats the two lists as separate, like “(list 1:filtered) merged with (list 2:filtered)”, I ran into an issue with a complex expression where Bubble’s logic was reading it differently, and was actually incorporating merged with into one of the expressions’ logic. So I wonder if Bubble is actually reading your expression as “(list 1:filtered merged with list 2):filtered”. If you haven’t done the step by step examination in your debugger, that may be informative to see what’s going on.

A solution I used at the suggestion of bubble support was to create a hidden repeating group to hold one of the lists, and then I used merged with to merge a list with the list in the repeating group. That worked as a workaround, but I still consider the behavior of “merged with” to be buggy for the reason I explained above.

2 Likes

Ok, thanks a lot…

The good news is that with SEARCH, you can merge more than 2 lists. So, thank you for this.

Bad news is that, as expected, that’s really slow (and I only got about 10 things for testing…) : SEARCH A for (condition 0 AND condition 1) merged with SEARCH B for (condition 0 AND condition 2) merged with SEARCH C for (condition 0 AND condition 3) …

What a pity.

I will also try your workaround with the hidden RG.

Until that, I can also pray for some rational (and so evident when you start working with DBs !) new feature from Bubble here !

Thanks again,

Michel

PS. if anyone else knows any easy way to do this, please fire !

Good luck. I haven’t had an issue with slowness due to “merged with” in and of itself, so the slowness may be due to the specifics of how your searches/filters are put together and your data is structured.

The hidden repeating groups may speed things up a little if they are able to load lists in the background.

One thing I’m learning is that Bubble seems to evaluate expressions on a strict left to right, which was causing me all sorts of issues trying to used “merged with” within complex expressions. That said, I was even splitting everything up in a workflow, with each merged with as a separate step, and I still had issues (which I don’t understand, since I thought each workflow step was completed before moving on to the next).

I eventually got things to work by experimenting with how expressions were ordered, using “converted to list” to close off part of an expression, and as a last resort using a hidden repeating group.

1 Like

FYI, that’s EXACTLY how that expression evaluates.

2 Likes

Just in case:

My filter criteria are the different statuses that a Job adopts during its life, and these being Option Sets, I assigned an Attribute to each one, arbitrary, which ranks them chronologically (I call this “ranking”).

Then, the filter of my RG becomes “status>Option set’s ranking”.

This allows to gather all Jobs whose status is later at a given time, excluding the others.

Michel

I set three different custom states (each a list) to a different search:filter, and then a final fourth custom state (list) to custom state 1 merged with custom state 2 merged with custom state 3. Seems to be working OK.

1 Like

This seems to be exactly what I am experiencing right now.

I thought I could merge “Current User’s List of things:filtered” merged with “Current User’s List of things:filtered” but I to only get the results of the second expression.

Again, “Do a search for” works as expected but is not as efficient from what I have read. Time to rework.

@dan8 where did you read that a “Do a search for” search is less efficient than a “:filter” search? Everything I’ve read says to avoid the latter unless absolutely necessary since it’s run client side.

Three years of Bubbling!

My understanding is “doing a search for:” is a lot less efficient than having a list of things and filtering for example.

So if you had an RG, it’s data source being a list of things will be more efficient than the do a search for.

On a side note, I solved my issue by keeping the list of things route and setting up some tight privacy rules (actually made it so much easier in my use case). Then to get rid of the “ghost” spaces, I just collapse the group when empty for the user. Much better than trying to merge multiple constraints for the same “thing”.

1 Like

Thanks, I see! I think the best approach is dependent on the size of the dataset and how it’s organized. If you had tens of thousands of entries it wouldn’t be practical to store that as a list under another datatype, and then dumping all those items into the browser and filtering from there would probably bog down or crash the browser. But for a dataset organized into manageable pieces, I see how it could be snappy.

1 Like

Ran into this issue and the work around was merging a custom state that was a list:filtered with another custom state that was a list but set elsewhere. If you try to merge two lists, each filtered (even if the lists are different) the logic doesn’t work on bubble’s back end it seems.