Advanced filtering issue when multiple conditions

Dear community,

I’m facing an issue while trying to modify the behavior of my page based on some filtering options. It seems to be related to the order of precedence or how I’m implementing the filtering options.

I’ve experimented with different configurations but haven’t been able to pinpoint the problem.

Here’s the scenario: I have items in a database with a geographic address field. I also have a dropdown menu with options “greater than or equal” and “less than or equal” and an input field where users can enter a desired distance.

The expected behavior is straightforward: when a user selects “greater than or equal” and enters 1000 km, the system should compare the items and display those where the distance between the two addresses is greater than or equal to 1000 km. Conversely, if “less than or equal” is selected, the system should only show results where the distance is less than or equal to 1000 km.

Here is my current filter:
filter

With this setup, the filter works correctly when “greater than or equal” is selected. However, when “less than or equal” is chosen, the system returns no results, regardless of the value entered.

As a programmer, I suspect the issue might be related to the order of precedence. I would typically resolve this by enclosing the conditions in parentheses, but that doesn’t seem to apply here.

I am confident that the system is calculating the distance correctly. I verified this by removing the condition and adding a textbox to display the distance between the items, and the calculations appear accurate.

When I remove the ‘or’ statement and use just one of the conditions, the program works perfectly.

Could anyone help me understand why this isn’t working?

Why can’t you use the 2 conditions separate?

1 Like

Thank you for idea! I found a workaround based on it, although I’m still unsure why the first filter isn’t working. Here’s how I managed to make it work:

filterworkaround

It would still be interesting to learn how to combine that into a single filter.

I don’t know if I’m right about this, but maybe the problem here is the larger conditions. At some point, bubble fails to understand when some conditions are extensives

This topic was automatically closed after 70 days. New replies are no longer allowed.