-
Notifications
You must be signed in to change notification settings - Fork 4
AB#84023 - Add 'in' and 'notIn' operator for dashboard filters #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AB#84023 - Add 'in' and 'notIn' operator for dashboard filters #951
Conversation
MwanPygmay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guisoares1 working well for resources, but did not work for reference data, created front-end branch for it, will edit the pr
| } | ||
| case 'notin': { | ||
| if (isAttributeFilter) { | ||
| if (MULTISELECT_TYPES.includes(type)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MwanPygmay
is there any reason why this is so different from the solution proposed in the first file?
# [2.9.0](v2.8.0...v2.9.0) (2024-04-29) ### Bug Fixes * Graphql questions would not display text values in history downloads [#91235](https://github.com/ReliefApplications/ems-backend/issues/91235) ([#1026](#1026)) ([676f035](676f035)) ### Features * Add 'in' and 'notIn' operators for record queries ([#951](#951)) ([e850042](e850042))
Description
Implemented two new operators in the query system: ‘in’ and ‘notIn’.
The ‘in’ operator checks if a given value is present in an array.
The ‘notIn’ operator is the opposite of the ‘in’ operator.
Useful links
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Screenshots
Result of tests
Base filter test object:
{ "logic": "and", "filters": [ { "logic": "and", "filters": [ { "logic": "and", "filters": [] } ] }, { "logic": "and", "filters": [ { "field": "name", "operator": "in", "value": ["elemento1", "elemento2", "elemento3"] } ] } ] }Result to "in":
{ "$and": [ { "$and": [ {} ] }, { "$and": [ { "data.name": { "$in": [ "elemento1", "elemento2", "elemento3" ] } } ] } ] }Result to "notin":
{ "$and": [ { "$and": [ {} ] }, { "$and": [ { "data.name": { "$nin": [ "elemento1", "elemento2", "elemento3" ] } } ] } ] }Checklist:
( * == Mandatory )
More explanation
https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145