MoneyWorks Manual
Edit
IncrementUserSeq (key)
Result Type: string
Definition: Atomically increments the User.Data value of a user record identified by key (creating the record with a data value of 0 if it does not already exist). Returns the incremented value. Although User.Data is a text field, IncrementUserSeq will increment the numeric part of it if it has a non-numeric prefix or suffix.
To set an initial value for a sequence, you can use SetPersistent("user", key, NULL, CreateArray("Data", initialValue))
Example:
constant key = "MYSEQ"
on Load
// set initial value
SetPersistent("user", key, NULL, CreateArray("Data", "XY-998-Z"))
// increment 3 times
Syslog(IncrementUserSeq(key))
Syslog(IncrementUserSeq(key))
Syslog(IncrementUserSeq(key))
// values returned:
//
// XY-999-Z
// XY-1000-Z
// XY-1001-Z
end