currVal Method

Class: Db

Description

This method returns the highest key value from the specified table.

Syntax

Db.currVal(literal String table,literal String accessKeys)

Parameters

tableName

A valid database table name.

accessKeys

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

Returns

The highest key value in the table for the key subsequent to the key(s) specified. For example, if no keys are specified, the method returns the highest value of the first key. If the table specified is a two-key table (such as HIST) and the first key is specified (CID in this case), the method returns the highest value for the seond key (TSEQ in this case).

When Became Available

v6.0

Example

set ACN = Db.currVal(“CIF”)    // Highest Customer Number

set SEQ = Db.currVal(“HIST”,”CID=:CID”)  // Last history sequence

                                       // for the CID account

 

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

to the currVal statement.