My problem is that I don't know/understand how to sort complex arrays.
I have a multi dimensional array of users from an external API. So it's not an array that I fetch from the Craft database. Let's call this array the "Main Array".
The Main Array contains multiple users, every user has multiple fields such as firstname, lastname, department, and so on. So every user in the Main Array is actually another array that we shall call a User Array. So the Main Array consists of multiple User arrays which consists of multiple fields.
First I group the Main array by the department field of a user (using the Twig group filter). So far so good, that way I can list all my users in department blocks.
But within those blocks, I want them to be alphabetically sorted by their lastname. So I need a way to let Craft know to sort my User Arrays by the lastname field of a user within the Main Array.
Seems logical and simple, but I can't figure out how. I tried SuperSort, but the standard asort function won't work. I than tried superSort('SortAs', '{lastnameField}') but that didn't work either.