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

Feature Request: Capability for users to filter by null values (instead of empty string "") for string type field

Answered
Benawi Adha asked on April 28, 2022

Hello there, Flexmonster Dev Team.
 
So the situation is, in our dataset, for string type fields, other than values with empty string "", we also accommodate null values (ie. python's pandas.NA, numpy.nan). And both, empty string values and null values, have pretty difference concept in our dataset. And we would like for users to have the capability to filter by both empty string "" and null values.
 
With current flexmonster, we can only filter by empty string (with string query interface, ie: equal, not equal), eg:

[
{
"field": {
"uniqueName": "auth_gender"
},
"query": {
"equal": ""
}
}
]

Is there possibility to have such feature so we can filter by null like this?

[
{
"field": {
"uniqueName": "auth_gender"
},
"query": {
"equal": null
}
}
]

 
Thanks,

6 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster April 29, 2022

Hello, Benawi!
 
Thank you for writing to us.
 
Our team wants to suggest trying the distinguishNullUndefinedEmpty option for your case. When set to true, the null, undefined, and "" would be treated as different values.
This option can be added in your report as follows:

report:{
slice:{...},
options: {
distinguishNullUndefinedEmpty: true,
}
}

We have prepared a JSFiddle sample for illustration: https://jsfiddle.net/flexmonster/z5yb8tmv/.
 
You can find more information about available options in our docs: https://www.flexmonster.com/api/options-object/.
 
Please let us know if it works for you. Feel free to contact us if other questions arise.
 
Regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 10, 2022

Hello, Benawi!

Hope you're having a great week.

Our team is wondering if you had a chance to try the suggested property to filter by null and string values separately. Could you please confirm that it works for you?

Looking forward to your response.

Regards,
Solomiia

Public
Benawi Adha May 11, 2022

Hey, Solomia.
 
Sorry so much I was on a break last week. We put this implementation on hold for the moment, sorry, because we have other priorities at the moment... But we will get back on this and reach out to you. It seems

distinguishNullUndefinedEmpty

Is what we wanted, we just overlooked it from flexmonster doc. Let us try it and make sure. Thanks...
 
Regards,
Benawi

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 11, 2022

Hello, Benawi!

Thank you for your response.

Your confirmation is valuable for our team. We'll be waiting for the next updates on the case.

Feel free to contact us if any further questions arise.

Regards,
Solomiia

Public
Benawi Adha May 24, 2022

Hey there, Solomiaa.
 
Just tried & confirmed it. Yes, this is exactly what we needed...
Thanks!
 
Regards,
Benawi

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 24, 2022

Hello, Benawi!

Thank you for your feedback.

We are glad to hear that it works for you.

Feel free to ask in case of any other questions.

Regards,
Solomiia

Please login or Register to Submit Answer