Develop > Programming > System Language reference > List: rtecalls > rtecall("getnumber") function

rtecall("getnumber") function

A RAD function that replaces the getnumb RAD application.

Function

rtecall("getnumber")

Format

$L.flg=rtecall($L.fnc.name, $L.return.code, $L.number, $L.class, $L.field)

Parameters

The following parameters are valid for the rtecall("getnumber") function:

Parameter Data type Description
$L.flg Logical The value is true for success and false if an error occurs.
$L.fnc.name String The name of the sub-function to call, in this case "getnumber".
$L.return.code Number The value is zero (0) if everything is correct, negative one (-1) if an error occurs. This is related directly to $L.flg.
$L.number String The number or string returned
$L.class String The class of number for which you are searching (from the number file).
$L.field String Reserved for future use.

Factors

A sequential overview:

  1. The function establishes a lock called "getnumb"+$L.class+$L.field and waits until the lock is established.
  2. If the number class is not found, or if there are duplicates, the following error displays: ($L.flg=false)
  3. The function reads the current number.
  4. The function increments or decrements by the step value. The step defaults to one (1).
  5. If incrementing and the number is greater than the reset value, it uses the start number. Start defaults to zero (0).
  6. A new field called string.flg.

    • If string.flg is false, it remains a numeric type.
    • If string.flg is true, the number is converted to a string.
    • If string.flg is unknown, or the field isn’t in the database dictionary (not added during an upgrade), the function checks for a prefix, a suffix, or length. If any one of these exists, the function converts the value to a string. If none of these exist the function leaves the value as a number.
  7. To convert the value to a string, the function uses the prefix, corrects the length of the number (padded with zeros on the left), and then adds the suffix.
  8. The function eventually saves the new number to the file and returns it to the user, converted to a string if necessary.
  9. Finally, it unlocks and returns.