Hi,

I am facing issue on Views Filter And/Or operator. When I want to apply Or operator between 2 filters in a new group then it always takes And operator and filter result accordingly.

Steps to reproduce:
1. Create views and add 3 or 4 filters
2. Create new filter group on click to rearrange
3. Drag at least 2 filters
4. Change operator to Or and save.

Comments

kamalrajsahu21 created an issue. See original summary.

Priyanka.addweb’s picture

It works fine at my end.

Some file configuration in your drupal setting. Please check all module installation proper.

I work in drupal 8.x-3.x.

Lendude’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.3.x-dev
Component: Miscellaneous » views.module
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
Issue tags: -views filters, -Filter Operator
suchdavid’s picture

Hi
I experience the same problem, It happens when you have more than 2 filter group. When you have only two filter groups the operator can be changed and saved, but when you have three, when you change the first operator, it won't be saved. Changing the second operator after saving, both operator will have the value set for the second.
Probably it is not connected to rearrangement, because the problem occurs after the filters are arranged in the appropriate group and get saved. After you click on to re-edit the connection the problem arises.

Lendude’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Reading this again, this sounds like a duplicate of #2865149: We should always use defined group and #2559961: ManyToOneHelper ignores group configuration for some cases. If this is a different issue, feel free to reopen.

plurial’s picture

I'm facing exactly the same issue on Drupal 8.8.2. If I have two groups, I can set the operator between groups as expected. But once there is a third group, this doesn't work. Changing the operator between first two groups have no effect. Changing the operator between last two groups applies the selected operator to all operators between groups.

So in resume, as soon as there are more than two groups, the operators between groups can only be all AND or all OR. Not mixed. It's not possible to have Group1 AND Group2 OR Group3. I have the feeling that this is due to the fact that when you have a filter like

GROUP1
OPERATOR1
GROUP2
OPERATOR2
GROUP3

OPERATOR1 and OPERATOR2 dropdowns have the same name. They are both named filter_groups[operator].

joekers’s picture

I'm facing the same issue as @plurial. It seems as though only one operator can be set between groups (filter_groups:operator:) so no matter how many groups there are, it will always be the same operator. I think I might be able to restructure to the filters/groups to achieve what I need to do, which isn't ideal, but I can't see something like this being changed in the module.

kevinhbruce’s picture

I have this same issue with 3 groups of filters—the first and/or won't save unless I change the second to "and" and then both save to "and". When I change the second and/or back to "or", the first and/or switches to "or" as well—on it's own.

Mohamed Nabawy’s picture

is this issue @plurial mentioned resolved in 9 or still exists as it's happening at my end with 9.3

vonn.new’s picture

I'm still having this issue on 9.4.5