AddKey (set the file's keys)

Top  Next


AddKey ( key, description [,autoincrement] )


Describes a KEY or static INDEX of the managed file.


The label of the KEY or static INDEX.


A string constant, variable, EQUATE, or expression describing the key.


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).


The description appears at runtime on certain key related error messages.


Access:Client.Init  PROCEDURE


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:     <a href="”>Init</a></p> </td> </tr> </tbody> </table> </div>