GenerateCodeNumber

You can use this function for Optiva Workflows and Copy Methods.

Purpose

Generates a unique code number that can be used to create new objects.

Syntax


Dim codeNumber As String = GenerateCodeNumber(createRule)

Arguments

Part Description
createRule The create rule to be used for the object code.

To create a unique key, include a SEQUENCE segment in the rule instead of NEXTKEY.

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)