-
-
Notifications
You must be signed in to change notification settings - Fork 817
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 data segmentation functionality #23059
Conversation
(Standard links)
|
59f06e0
to
d413a1b
Compare
I've been reading the unit-test, and it looks like neat functionality. It almost looks like a custom computed (on-demand) field. In the example:
Describing this with the word "pivot" is confusing to me. As I understand it, the "pivot" in "pivot table" refers to transposing the placement of rows/columns/values. The functionality here seems independent in two ways:
To make this concrete, let me offer a few examples that seem like plausible use-cases:
These classifications are all a bit futzy. (Is "Virginia" in the "South" or "Mid-Atlantic"? Does 4:45am qualify as "Late Night" or "Morning"? Is November 15 in the "Winter"?) So if you're using these classifications, then the functionality here seems quite useful. (You can twiddle the classifications to match the organization's standards.) The classifications certainly could appear in a pivot table (eg "Show me a list of regions, with the total-donation-amount from each"; or "Show me the times-of-day, with the average donation amount for each"). But you would also the same classification for a drill-down view ("List all cancellations from the Mid-Atlantic region"). It would also be useful in record-views. ("Alice Alison's home address is So just as a labeling thing, |
Based on extensive discussion our committee has reached a compromise and renamed the new entity |
cee2c0d
to
5cf08c2
Compare
Before: Calculated field functions were repeated verbabim in the SELECT, ORDER BY & GROUP BY clause, this would cause mySql error when using FULL GROUP BY mode. After: Calculated field function defined in SELECT clause, alias used in ORDER BY & GROUP BY. No error when grouping by an ordering by the same calculated field. Side-benefit: When selecting and ordering by RAND(), the selected random numbers will be in order, as it's now the same random function used for both instead of a different one.
This permits SearchSegment pseudo-fields to call $query->getField() on multiple fields, including custom fields, while rendering.
…earchSegment clause.
Thanks for testing this @samuelsov. Yes this PR is ready for review. |
@colemanw I had a similar experience to @samuelsov - recreated here http://core-23059-10nxw.test-3.civicrm.org:8001/civicrm/admin/search#/edit/2 |
@colemanw Based on my testing this is working - with the exception of the above issue - which you are working on a patch for. I think on balance it is better to merge this and then keep testing / improving at this stage since I think we will have incremental improvements / requests from here The 2 things I noticed were
|
I would also note an advantage of merging is that it can be put though the hoops better on your Europe sojourn |
@samuelsov @eileenmcnaughton this fixes the bug you noticed. It was a bug in the Angular UI which is why the PHPUnit tests didn't catch it. #23265 |
Overview
Creates virtual fields based on flexible segmentation criteria.
Creating a Segment:
Example use: