Using eval and rex to define grouping fields