[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'DB' (#fcl)

# TIndexDefs.FindIndexForFields

Find index definition based on field names

## Declaration

Source position: db.pas line 1075

`public function TIndexDefs.FindIndexForFields(`
`const Fields: string`
`):TIndexDef;`

## Arguments

`Fields` |  | Fieldlist to look for

## Function result

TIndexDef instance with fieldlist matching Fields

## Description

FindIndexForFields searches in the list of indexes for an index whose TIndexDef.Fields property matches the list of fields in Fields. If it finds an index definition, then it returns the found instance.

## Errors

If no matching definition is found, an exception is raised. This is different from other Find functionality, where Find usually returns Nil if nothing is found.

## See also

TIndexDef |  | Index definition
TIndexDefs.Find |  | Find an index by name
TIndexDefs.GetindexForFields |  | Get index definition based on field names