Oh, yeah. I know I, for example, have posted essentially that same getGroupValue code (with minor variations, to be sure) at least a dozen times in this forum. And many other members have posted similar stuff. It's here. It just might be hard to guess what keywords to use to find it.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.