Equinox Online Help - Language Reference - A to Z

Home

AtomicIncrement

Applies to
SyntaxAtomicIncrement workarea, newvalue
Action[Function] Returns an application-wide unique number
ScopeUsable anywhere.
Notes

This statement is intended to provide a simpler, faster and more reliable mechanism for supplying an application-wide unique numeric value, and replaces code like the following:

lock publicworkarea
publicworkarea += 1 mynewvalue = publicworkarea
unlock publicworkarea

All numeric workareas are compatible with

CategoryMaths
See Also  
Example

This example increments the workarea pwglobalunique and uses it as the next ID for the record being inserted.

[Before Any Save]
if cuUnique = 0 then
AtomicIncrement pwglobalunique, cuUnique
end if