Currently fields can be aggregated by the following types:
- Fulltext
- Sum
- Count
- Maximum
- Minimum
- First
- First Letter
- List
It would be great if it were possible to aggregate by "Last" as well.
As explained by drunken monkey, it would be possible by patching the module in the following way:
No, but it should be simple to add this yourself – either by directly modifying the existing data alteration or by copying the code to create a new, custom one.
I figured I'd add this as a feature request, in case someone with module coding knowledge also has interest in this feature. Thanks in advanced for the feature request consideration!
Comment | File | Size | Author |
---|---|---|---|
#20 | 2765317-18-20-last_aggregation--interdiff.txt | 2.52 KB | vasike |
#20 | 2765317-20--last_aggregation.patch | 2.3 KB | vasike |
| |||
#11 | 2765317-11--last_aggregation.patch | 1.79 KB | drunken monkey |
|
Comments
Comment #2
drunken monkeyThanks for creating the issue!
I'm not sure how many people could use this feature, but it's a pretty small change, so if someone provided a patch I'd review and commit it.
Comment #3
JorgenSandstrom CreditAttribution: JorgenSandstrom for Miss Mary of Sweden commentedTry this patch. It works for me. I set data type to "text" in stead of string so the result can be used as well for output.
Comment #4
drunken monkeyThanks for the patch – however, the request was for "Last", not "Last letter".
Otherwise, looks good, though. Do you need this type on your site? It seems even more of a niche feature than "Last", but same argument: it's a very small addition, so should be fine.
I would stay with
string
as type, though, to be consistent – the user can change the type themselves in any case.Comment #5
NWOM CreditAttribution: NWOM commentedHere is a patch that includes Last and the aforementioned Last Letter aggregation types. Please review.
Comment #6
NWOM CreditAttribution: NWOM commentedComment #7
drunken monkeyGreat job, thanks!
Would be nice if someone could test this and verify it works correctly, but otherwise I guess I'd still commit it.
However, again the question – does anyone actually want "Last letter"? Otherwise, I'd really leave that out, it doesn't seem useful for even those few lines of code (plus the UI clutter, which weighs more heavily). Also, it's a bit strange, I think, that it takes the last letter from the first value, not the last – but that's debatable.
Comment #8
NWOM CreditAttribution: NWOM commentedYeah, I can't see a use case for it either to be honest. @JorgenSandstrom what is your use case for Last Letter of the first value?
Comment #9
JorgenSandstrom CreditAttribution: JorgenSandstrom as a volunteer commentedI'm sorry. I misunderstood the issue description. I came across this while working on a custom aggregation type and thought I'd help. I do not have a use case for last letter.
Comment #10
NWOM CreditAttribution: NWOM commentedOh, well thank you anyways for the help. It definitely helped me create the patch (since I wasn't sure how to create one myself). When I have more time, I will re-add the patch with just the aggregation type "Last" then.
Comment #11
drunken monkeyAh, OK, thanks a lot for clearing that up, everyone!
Then here is the patch with just "Last". Please give it another try and I can commit it.
Comment #12
NWOM CreditAttribution: NWOM commentedAh thanks for this. Was wrapped up in a few features for a project the last few weeks, that I forgot to come back to this issue. Will test it out tomorrow and mark as RTBC.
Comment #14
drunken monkeyComment #15
NWOM CreditAttribution: NWOM commentedIt works great! Sorry again for the delay. Appreciate you adding this to the module. I hope it helps others that are looking for the same feature.
Comment #17
drunken monkeyNo problem, thanks for reporting back!
Committed.
Thanks again, everyone!
Needs to be ported to D8 still. (As does the "First letter" aggregation, now that I look at it.)
Comment #18
vasikelet's try a patch
Comment #19
drunken monkeyThanks a lot for the patch, looks pretty good already!
However, why do you need to remove the one assertion for the "Last" type? I don't see a reason why it shouldn't apply – you just need to pass the right expected values.
Also, I'd remove "simply" from the description – I can see you just copied the description from "First", which of course makes sense, but if they're too similar it kinda looks weird, reading them one after the other.
Comment #20
vasikehere is an updated patch (and its diff) for the requested changes (#19)
Comment #22
drunken monkeyLooks great now, thanks!
Committed.