Looking at the current documentation for the Custom Data Source API in order to implement it in my project (https://www.flexmonster.com/api/filter-object-for-requests/). The Filter object is defined recursively:
[{
"field": FieldObject,
"include"[]: {
"member": string | number,
"filter": FilterObject
},
"exclude"[]: {
"member": string | number,
"filter": FilterObject
},
"query": {
(condition): string | number | string[] | number[]
},
"value": {
"field": FieldObject,
"func": string
}
}]
Filter
and Filter.include[0].filter
have the same schema/are the same type.
It isn't made clear anywhere how this is actually used, and the only explanation we have to go by is that this nested filter "specifies which filters should be applied to the member."
What is a use case for the nested filter property in either the include
or the exclude
properties of the filter?
Hi!
Thank you for posting your question.
The mentioned recursion in the structure of the Filter object for the custom data source API is necessary for use cases when the query is carried out on the multilevel hierarchies. This approach allows the filter to be applied to the lower levels of the hierarchy as well.
Also, we would like to mention the advanced
option of the /fields
request, which, depending on its value, enables or disables filtering for multilevel hierarchies. More info on this can be found by the following link: https://www.flexmonster.com/api/fields-request/
Please let us know if this helps.
Best regards,
Mykhailo
Okay, thank you that makes sense now. It will probably help future users to have that explanation in the documentation 🙂