Navigation: ABC Library Reference > FileManager > FileManager Methods >====== AddKey (set the file's keys) ====== | ![]() ![]() |
AddKey ( **key, description [,autoincrement]// //)**
| AddKey | Describes a KEY or static INDEX of the managed file. |
| key | The label of the KEY or static INDEX. |
| description | A string constant, variable, EQUATE, or expression describing the key. |
| autoincrement | An integer constant, variable, EQUATE, or expression that indicates whether the FileManager automatically generates incrementing numeric values for the key when inserting new records. A value of one (1 or True) automatically increments the key; a value of zero (0 or False) does not increment the key. If omitted, //autoincrement //defaults to zero. |
The **AddKey **method describes a KEY or static INDEX of the managed file so that other FileManager methods can process it. You should typically call AddKey after the Init method is called (or within your derived Init method).
Implementation:
The description appears at runtime on certain key related error messages.
Example:
** Access:Client.Init PROCEDURE**
** CODE**
** PARENT.Init(Client, GlobalErrors) !call the base class Init method**
** SELF.FileNameValue = 'Client' !set the file name**
** SELF.Buffer &= CLI:Record !point Access:Client to Client buffer**
** SELF.AddKey(CLI:IDKey,'Client ID',1) !describe the primary key**
** SELF.AddKey(CLI:NameKey,'Client Name') !describe another key**
**See Also: **Init





