def __init__(self, field, *byfields):
fieldstrs = []<EOL>if len(byfields) == <NUM_LIT:1> and isinstance(byfields[<NUM_LIT:0>], type) andissubclass(byfields[<NUM_LIT:0>], SortDirection):<EOL><INDENT>byfields = [byfields[<NUM_LIT:0>](field)]<EOL><DEDENT>for f in byfields:<EOL><INDENT>fieldstrs += [f.field, f.DIRSTRING]<EOL><DEDENT>args = [field]<EOL>if fieldstrs:<EOL><INDENT>args += ['<STR_LIT>'] + fieldstrs<EOL><DEDENT>super(first_value, self).__init__(*args)<EOL>self._field = field<EOL>
Selects the first value of the given field within the group.

### Parameter

- **field**: Source field used for the value
- **byfields**: How to sort the results. This can be either the
    *class* of `aggregation.Asc` or `aggregation.Desc` in which
    case the field `field` is also used as the sort input.

    `byfields` can also be one or more *instances* of `Asc` or `Desc`
    indicating the sort order for these fields