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 modulo operator to math function #24830

Merged
merged 2 commits into from
Oct 31, 2022

Conversation

colemanw
Copy link
Member

Overview

Adds support for the modulo operator to SearchKit math equations. This is mostly useful for testing whether a number is even or odd.

Example

The following clause will only return contacts for whom the value of a custom field is an odd number:
image

Comments

This math widget is a little tricky to use. By default it wants you to compare the field with another field, and switching that to a fixed value (in this case the number 2) means selecting and then deselecting a field to clear it out. I've simplified that process a bit in this PR by auto-picking the first available field so you at least have a way to clear it out immediately and don't have to select a dummy value.

@civibot
Copy link

civibot bot commented Oct 27, 2022

(Standard links)

@civibot civibot bot added the master label Oct 27, 2022
Instead of a blank field selector with no way to clear it,
it now picks the first available field for you so it's easier to clear
and replace with a number if you so choose.
@rainersalal
Copy link

Tested this PR on the Drupal demo site provided and confirmed that the modulo operator works as expected

@colemanw colemanw merged commit b55802b into civicrm:master Oct 31, 2022
@colemanw colemanw deleted the searchKitModulo branch October 31, 2022 17:46
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