GetNextNumber

Mon 01 January 2018

Syntax

GetNextNumber ({record.field | record_name, field_name}, max_number)

Description

Use the GetNextNumber function to increment the value in a record for the field you specify by one and returns that value. You might use this function to increment an employee ID field by one when you are adding a new employee. If the new value generated exceeds max_number , a negative value is returned and the field value isn't incremented.

The maximum value possible for max_number is 2147483647.

Parameters

Field or Control

Definition

record.field

Specify the record and field identifiers for the field for which you want the new number. This is the recommended way to identify the field.

record_name

Specify as a string the name of the record containing the field for which you want the new number. This parameter with field_name was used prior to PeopleTools 8.

field_name

Specify as a string the name of the field for which you want the new number. This parameter with record_name was used prior to PeopleTools 8.

Note: If you use the older syntax ( record_name , field_name ), you have to manually update these two parameters in your programs whenever that record or field is renamed. The new syntax ( record.field) is automatically updated, so you won't have to maintain it.

max_number

Specify the highest allowed value for the field you're incrementing. The maximum value possible for max_number is 2147483647.

Returns

A Number value equal to the highest value of the field specified plus one.

GetNextNumber returns an error if the value to be returned would be greater than max_number . The function returns one of the following:

Numeric Value

Constant Value

Description

Number

N/A

The new number

-1

%GetNextNumber_SQLFailure

SQL failure

-2

%GetNextNumber_TooBig

Number too large, beyond max_number

-3

%GetNextNumber_NotFound

No number found, invalid data format