How does the operator work on a logical expression?

Here is a typical logical expression used within a query rule

a!queryLogicalExpression(
    operator: "OR",
    filters: {list of filters here},
    ignoreFiltersWithEmptyValues: true
),

to my understanding, the expression above will query the data where either one of the filters is true. But if I changed the operator to AND it will pull the data where all the filters are true. Let's say I now have the following logical expression with nested logical expressions.

a!queryLogicalExpression(
            operator: "AND",
            logicalExpressions: {
              a!queryLogicalExpression(
                operator: "AND",
                filters: {
                 a!queryFilter(
                    field: "user",
                    operator: "=",
                    value: value: cons!MY_NAME
                  ),
                                    
                },
                ignoreFiltersWithEmptyValues: true
              ),
              a!queryLogicalExpression(
                operator: "AND",
                filters: {
                  
                  a!queryFilter(
                    field: "name",
                    operator: "=",
                    value: cons!MY_NAME
                  ),
                  
                },
                ignoreFiltersWithEmptyValues: true
              )
            }
          ),

To my understanding, this is saying query the data from the table where user equals my name, and query the data from the table where the name is my name and then combine them to create the overall query result. However, this doesn't seem to be case. My query returns nothing as if it was saying find the data where the user is my name AND the name is my name. If I switch the first operator to be OR then it returns only one result from the two inner expression rules. 

Could someone explain why this is the case? How can I combine multiple expression rules so I can retrieve the data with multiple expression rules for multiple cases and combine them as one?

  Discussion posts and replies are publicly visible

Parents Reply
  • What about this?

    a!queryEntity(
      entity: cons!YOUR_ENTITY,
      query: a!query(
        logicalExpression: a!queryLogicalExpression(
          operator: "OR",
          logicalExpressions: {
            a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "status_id",
                  operator: "=",
                  value: cons!STATUS_ONE
                ),
                a!queryFilter(
                  field: "name",
                  operator: "=",
                  value: cons!MY_NAME
                )
              }
            )
          },
          filters: {
            a!queryFilter(
              field: "status_id",
              operator: "=",
              value: cons!MY_NAME
            )
          }
        ),
        pagingInfo: local!pagingInfo
      )
    )

Children
No Data