GenerateCodeNumber
You can use this function for Optiva Workflows and Copy Methods.
Purpose
This function generates a unique code number that can be used to create new objects.
Syntax
string GenerateCodeNumber(string createRule)
Return Value
If the code is successful, it displays the unique code as a String.
Arguments
| Part | Description |
|---|---|
createRule |
The create rule associated with the object symbol, for which the unique code is generated. |
Description
GenerateCodeNumber uses a pre-defined create rule to generate a code number for an object.
Example
This example uses the EXP FORMULA create rule to generate a code for a new formula based on PIZZA SAUCE\0001. The code is then applied to a new formula that is saved from an existing formula PIZZA SAUCE\0001.
Dim sCodeNumber As String = GenerateCodeNumber("EXP FORMULA")
MessageList("The new formula will be:", sCodeNumber)
Dim rc As Long = ObjectSaveAs("FORMULA", "PIZZA SAUCE\0001", sCodeNumber)
The script generates a new unique formula code using the "EXP FORMULA" create rule, then creates a copy of the existing formula "PIZZA SAUCE\0001" with this new code.
string CodeNumber = GenerateCodeNumber("EXP FORMULA");
long rc = ObjectSaveAs("FORMULA", "PIZZA SAUCE\\0001", ref sCodeNumber);