Skip to content
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

Adapt filters with empty and null values in alphanumeric custom fields #19057

Merged
merged 1 commit into from
Dec 30, 2020

Conversation

CsarRamos
Copy link
Contributor

@CsarRamos CsarRamos commented Nov 26, 2020

Overview

Hello,

I have created a group of custom fields and a new custom field type "Alphanumeric". Then I have created two contacts without assigning them any value in the custom field. Finally I have tried to filter the field in the reports as "is empty (NULL)" and the report shows only the null results. (When the contact is created it is assigned as empty)

Before

Reports don't filter with empty values in alphanumeric custom fields

After

The reports filter with empty values and null values in alphanumeric fields (Include default fields, ex: contact source)

Comments

issue: https://lab.civicrm.org/dev/core/-/issues/2173

@civibot
Copy link

civibot bot commented Nov 26, 2020

(Standard links)

@civibot civibot bot added the master label Nov 26, 2020
@eileenmcnaughton
Copy link
Contributor

@CsarRamos the test fail relates - I think the metadata you are using might not always be set. I think the change probably makes sense

ping @yashodha @MegaphoneJon

@eileenmcnaughton
Copy link
Contributor

@MegaphoneJon @yashodha I'm inclined to merge this - looks good to you?

@MegaphoneJon
Copy link
Contributor

@CsarRamos @eileenmcnaughton What effect will adding an OR to the SQL here have on the ability to use indices?

@eileenmcnaughton
Copy link
Contributor

@MegaphoneJon the OR problem with indices are when the OR is on 2 field in separate tables

@MegaphoneJon
Copy link
Contributor

Thanks Eileen. I haven't r-run this but I reviewed the code, and conceptually I approve of the change. My only concern is that the user-facing label is is empty (NULL) when is empty would be more accurate after this change - but that's a pretty minor nitpick.

@eileenmcnaughton
Copy link
Contributor

I was able to r-run this - I agree the null thing in the label is a bit misleading now - but it does work as described and it seems more intuitive

@eileenmcnaughton eileenmcnaughton merged commit 3662d5a into civicrm:master Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants