nextKey Method

This method has been deprecated and should not be used in Profile versions v6.4 and above. Use ResultSet.next or DbSet.next on an appropriate, ordered selection.

Class: Db

Description

This method returns the next key value from the table. If the code logic requires collating through primary keys, use DbSet or ResultSet methods.

 

The nextKey method can cause performance issues when used against non-M databases. When used to get the keys of the record followed by instantiation of a record, it causes multiple database accesses. Use the DbSet or ResultSet methods instead, since those methods store the required data retrieved from the first database access.

Syntax

Db.nextKey(tableName,accessKeys)

Parameters

tableName

A valid database table name.

accessKeys

A comma-separated list of access keys for the table.

Returns

The next available key value.

When Became Available

v6.0

Example

type String XBRCD,XSEQ

set XBRCD = Db.nextVal(“UTBLBRCD”)       //highest Branch Code +1    

set XSEQ = Db.nextVal(“HIST”,”CID=:CID”) //Highest History  

                                         //Seq+1 for a CID

                                         //account

 

* In the second example, variable CID must be defined prior

to the nextVal statement.