Versions
All

Purpose
Replaces the getnumb RAD application.

Syntax
Code:
$L.success.flag=rtecall("getnumber", $L.return.code, $L.number, $L.class, $L.field)
  • $L.success.flag
    true = success
    false = failure
  • $L.return.code
    returncode of the call
  • $L.number
    The number/string returned
  • $L.class
    Class of number for which you are searching (from the number file).
  • $L.field
    Reserved for future use

Example
Code:
$L.flg=rtecall("getnumber", $L.return.code, md.id in $mdeventlog, "mdeventlog", $L.field)
Factors
Establishes a lock called "getnumb"+$L.class+$L.field and waits until the lock is established.
If the number class was not found, or if there are duplicates, it will return an error ($L.flg=false)
Reads the current number.
Increments/decrements by the step value (step defaults to 1)
If incrementing and the number is greater than the reset value, it will use the start number (start defaults to 0)
If decrementing and the number is less than the reset value, it will use the start number (start defaults to 0)
New field called string.flg
If string.flg is false, it will remain a numeric type
If string.flg is true, it will convert the number 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
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 adds the suffix.
The function eventually saves the new number to the file and returns it (converted to a string if necessary) to the user.
Finally, it unlocks and returns.