We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Question for AND OR problem in the FilterGroupObject for multilevel hierarchy

Re-Open
Heejai asked on March 29, 2022

Hello,
I have a question about multilevel hierarchy. It is in the attached file.
Thanks.

4 answers

Public
Vera Didenko Vera Didenko Flexmonster March 31, 2022

Hello, Heejai,

Thank you for your question.
 
We would like to confirm that the "and" filter type is correct in this scenario. This is because Flexmonster makes several /select requests targeting different parts. As a result, the visualization on the grid is achieved through several /select requests.

For example, in your scenario:

  • First, when you apply the filter, Flexmonster makes a /select request to display the filtered data.
  • Then, when you drill down "QLD", Flexmonster sends another /select request, this time targeting the drill-down action.
    Let's take a look at the filter structure in the /select request for the drill down. We can see that the filter first focuses on getting data for the drilled hierarchy member "QLD":
    "filter":{
    "type":"and",
    "value":[
    {
    "type":"and",
    "value":[
    {
    "field":{"uniqueName":"description_state"},
    "include":[{"member":"QLD"}]
    },
    {...}
    ]
    }
    ]
    }

    Next, the filter provides additional details about the surrounding members that can be used to help ensure the filter accuracy:

    "filter":{
    "type":"and",
    "value":[
    {
    "type":"and",
    "value":[
    {...},
    {
    "field":{"uniqueName":"description_state"},
    "exclude":[
    {"member":"ACT"},
    {
    "member":"NT",
    "filter":{
    "field":{"uniqueName":"description_settlement_type"},
    "include":[{"member":"metro"}]
    }
    }
    ]
    }
    ]
    }
    ]
    }

     

With this in mind, the "and" filter type is correct in this scenario.
 
We hope this helps. Please let us know if any additional questions arise.
 
Kind regards,
Vera

Public
Heejai April 1, 2022

Thanks for the answer.
How about "or"? I've never seen the case "or". When can I see it?

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 1, 2022

Hello, Heejai!

Thank you for quick response.

The "type: or" filter query is sent when it is not clear to which hierarchy level the filter is applied. 
Here is an example of a filter inside Flexmonster component, which will trigger sending a request with "type: or". This filter will select the members that start with "b":

filter: {
query: {
begin: "b"
}
}

Please refer to this example: https://jsfiddle.net/flexmonster/8uv15b34/.
In this JSFiddle, the hierarchies are shown when the top-level hierarchy "Category" OR bottom-level hierarchy "Color" have a label starting with "b".

Please let us know if this helps to clear things up. Looking forward to hearing from you.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 8, 2022

Hello, Heejai!

Our team is wondering if our response helped you to understand the purpose of "type": "or" requests in Flexmonster custom API communication protocol. Please let us know if it was helpful.

Best Regards,
Maksym

Please login or Register to Submit Answer