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

SearchKit - Add UI for arithmetic equations #21600

Merged
merged 2 commits into from
Sep 26, 2021

Conversation

colemanw
Copy link
Member

Overview

Allows adding, subtracting, dividing and multiplying any number of values in SearchKit
image

@civibot
Copy link

civibot bot commented Sep 24, 2021

(Standard links)

@civibot civibot bot added the master label Sep 24, 2021
@eileenmcnaughton
Copy link
Contributor

It's hard to make the case this example is very useful but it almost works - the handling of NULL is an issue.

@colemanw up to you if you want to merge & then fix the NULL or fix it & I'll re-test. I know you are doing some PR jugging at the moment.

image

@colemanw
Copy link
Member Author

@eileenmcnaughton I think you're referring to the way MySql handles NULL values in an expression by evaluating the entire expression to NULL. I don't think there's much we can do about that, it's a bug feature of MySql.
In a more realistic example, would it still be a problem?

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Sep 26, 2021

@colemanw yeah it would - my wmf code is utterly full of COALESCE or IFNULL statments - because they are often adding 'amount given to this fund + amount given to that fund.

The my sql looks like

total_amount = IFNULL('net_amount', 0) + IFNULL('fee_amount', 0)

@colemanw
Copy link
Member Author

Ok, I'd like to merge this & then think about how to address that issue.

@colemanw colemanw merged commit e56af21 into civicrm:master Sep 26, 2021
@colemanw colemanw deleted the searchKitEquations branch September 26, 2021 19:23
@eileenmcnaughton
Copy link
Contributor

cool - that's fine with me

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.

2 participants