Add a function for selecting fields from a struct array