-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
dev/core#2704 SearchKit - Add support for SQL functions #20947
Conversation
(Standard links)
|
@colemanw I'm struggling to figure out how to see the new functions - not in the listing here |
OK - some cache clearing and I can see they work with no aggregate in place but when aggregate is on the list is more limited (but distinct is back!) With no group by I get this bigger list And year only works As does time only but the output for 'date only' is confusing - it truncates the date but shows '12 am' instead of nothing The 'is null' one is pretty cool. 'math' and 'text' show - but can't be selected |
I'm thinking that we maybe should merge this as it is a clear improvement unless the others can be fixed up easily but this seems to be a good improvement |
@seamuslee001 no - it actually causes some things to disappear in aggregate mode at the moment |
What is disappearing @eileenmcnaughton ? |
@colemanw - see #20947 (comment) - first image - no MAX etc |
@eileenmcnaughton I can't reproduce that locally. Are you able to reproduce it on the demo site and post a link to that search? |
@colemanw total_amount & net_amount http://core-20947-5ue5k.test-1.civicrm.org:8001/civicrm/admin/search#/edit/1 |
Also - if you remove group by you get the weird thing with 'Text' being there 'as if' it means something but doesn't seem to (in the drop down) |
…bels This splits the concept of prefix/suffix into prefix, flag_before and flag_after, Since a prefix like ORDER BY is not the same as a flag like DISTINCT. Lays the groundwork for exposing more info about SQL functiont to a UI like SearchKIt.
Ah ok thanks @eileenmcnaughton - found it & fixed both issues. |
@eileenmcnaughton and I just pushed up another commit to fix the date formatting. |
@colemanw api\v4\Action\SqlFunctionTest::testGroupAggregates /home/jenkins/bknix-dfl/build/core-20947-610bn/web/sites/all/modules/civicrm/tests/phpunit/api/v4/Action/SqlFunctionTest.php:69 |
@eileenmcnaughton fixed |
@colemanw the Replace transform isn't working - perhaps you could suppress it long enough to get this merged & then re-add it? I'm otherwise happy with the pr |
Either way this describes the 3 params, but the new way is better understood by SearchKit, which to-date cannot handle more than one param.
@eileenmcnaughton done. It was supposed to be already hidden because this PR doesn't support > 1 field per function. |
The things I previously identified are fixed. I did spot one more thing - the functions being offered for amounts are suitable able for text rather than money columns. However, I think that one lends itself to being fixed in a follow up so I'm merging this now @colemanw |
Overview
Support SQL functions in the SearchKit UI
See https://lab.civicrm.org/dev/core/-/issues/2704
Before
Only aggregate functions supported
After
More functions work
Comments
For now it's limited to functions that take a single field as input.