8 – Alphabetical case insensitive grouping of results

To group all of your results by Last initial, capitalized:

First, under Format > Settings > Grouping field X, make sure you check the box to “Use rendered output to group rows”.

Second, update the field settings for the field you’re using to group the results – under Rewrite Results, check “Trim this field to a maximum number of characters,” and enter 1 for the length.

Finally, again under Rewrite Results, check the box to “Override the output of this field with custom text”. You can use twig in the custom text field and leverage twig’s upper filter to convert the entire string to uppercase. You’ll have to check the Replacement Patterns for the correct field name to use, but the end result should look something like:

{{ field_last_name|upper }}

The result is your view results grouped by last initial, capitalized (whether they start with a capital letter or not).