How to handle EMPTY value in 'intersect with' advanced filter

Hi,

I try to compare two lists with the advanced filter and for some circumstances it works also for empty values and sometimes not.

Any ideas where is a difference?

Regards
Gerald

Why don’t you check ignore empty constraints?

The way you fetch data needs some rethinking though.

1 Like

One advanced filter is better than 2, just use and/or accordingly, but separating them like this essentially makes it an AND constraint.

So for example, the results of a search using you current logic would only render a non-zero result if at least one of the conditions in the 2 separate advanced filters were true.

Then of course check your privacy rules.

FYI that search constraint setup will always result in loading ALL of the records in your “job” DB, that isn’t limited by privacy rules.

Always use the constraints within a Search as much as possible before using an advanced filter.

Because “Ignore empty constraints” validates empty inputs and listen to is empty or is not empty.

Advanced filter validate on yes/no or true/false. So they be never “empty”.

If you can show me a search filter where I can compare two lists, I would use that.

But as far as I know, bubble cannot compare lists in standard search criteria.

Thanks for pointing out the AND.

I wasn’t aware of that.

In this case, the search should be AND.

Any ideas why there is a difference between filtering THING values and filtering OPTION SET values?

Joining 2 searches with merge list is one way of ensuring you keep constraints within Searches.

Ultimately it’s a mix between client side data management and your database setup. The goal is the same, to retrieve only data a user needs when they need it.

1 Like

Do you have an example for that?

My main goal is to compare the selection of the user (list) with job configuration in the database (list of things).

For instance:
Two selections of the user should be compared to the job configuration.

Job Themes:

  • Heating, Immo, Facility

Drivers Licences:

  • A, B, BE

An example merge statement or screenshot would be great.

If it’s somethink like that?
Data source: “Do a Search for Pets’ Name” “:mergedwith” “Do a Search for Wild Animals’

Then I have a question:
How can I compare two lists in a “Do a Search for …”. The list from the user selection with the list of the job attributes.

Thanks,
Gerald

I am struggling to understand the relationship between these two lists (might be the German) not particularly worried about what you want to achieve at the moment, just the relationship between the lists.

Lists that operate as as option set do not necessarily need to be setup as an option set in the DB. You could create a table (data type) instead and work with that (might be easier to work with).

Also I have a hunch that creating a new table (datatype) which essentially becomes a unified version of the compared lists could be better than the current setup.

Im not that mad at the advanced filters though as the data is lightweight and appears to be limited. Just do a better job of explaining how these two lists relate and i think a data schema improvement could be on the cards.

I can help with this. The issue is that intersect with filters need both lists to have values to compare. When one list is empty, the comparison breaks.

Solution: Use ignore empty constraints checkbox for the advanced filter. This tells Bubble to skip the filter when the value is empty instead of trying to compare with nothing.

Alternatively, wrap your search in a conditional. Only apply the advanced filter when the list you’re comparing against isn’t empty.

Also as others mentioned, try consolidating your filters into one advanced filter using AND/OR logic. Multiple separate advanced filters can cause performance issues since Bubble has to load all records first then filter client-side.

Let me know if you need help restructuring the search logic.

Sorry wrong way.
That was not the question.

More details to clarify.

This is a job portal.

One list is the list the user select on the website filter.
For instance the themes. This means the topics of a job.

In our case heating, air conditioning, ventilation, electric installation, and so on.

The user can choose more than one theme he is interessted in. So it’s the list number 1. Let’s call it UserThemeList1 (e.g. values: heating, ventilation)

The second list is the list configured on the job. The job has also different themes like heating, air conditioning, ventilation, electric installation, and so on. Let’s call it JobThemeList1 (e.g. values: heating, electrical installation).

In the simplest way, I want to compare UserThemeList1 with JobThemeList1.

As Bubble cannot compare two lists in the search (server side) I HAVE TO use filters.
If I’m wrong, please give me a hint.

With filters (browser side) I can use the Advanced filter and so it is possible to compare two lists.

The question is

WHY is there a difference between comparing values from an option set to values of a data type (thing)?

Can you attach a snapshot of your schema for the Job data type?

DATA TYPE JOB

OPTION SET

DATA TYPE JOB THEME

The most important one is missing.

The schema for ‘Job’

The first image in the post above.

It’s only a part but contains the Drivers Licence and Themes.

Ah I see.

I don’t see a problem. Try adding :converted to a list:split by “,”

Could be a couple of other things, check that you don’t have duplicate “RG Theme Filter.”

Can you also let me know what the issue’s(error) caption is.

The problem is mentioned in the opening post.

When the user list is compared with the data type, entries with EMPTY VALUES are shown.

When the user list is compared with the option set, entries with EMPTY VALUES are NOT shown.

And I don’t understand the difference in the behavior.