How to create an auto generated number

Viewed 21
1 Answers

You put an initial value into the corresponding record in admin.DocumentNumber document (ADM_DocumentName table). You can either do this with an SQL insert as part of a deployment script or a manual deployment step through the admin module user interface (Admin->DocumentNumbers menu item)

If there is no DocumentNumber entry for the module/document/attribute combination, Skyve will create an entry starting at 1.

You can use something like

insert into ADM_DocumentNumber (bizId, bizVersion, bizLock, bizCustomer, bizDataGroupId, bizUserId, bizKey, moduleName, documentName, sequenceName, documentNumber) 
    VALUES (lower(newId()), 0, '20220714000000000admin', '<customer-name>', NULL, '<bizIdOf_ADM_SecurityUser>', '<module-name>.<document-name>.<attributeName>', '<module-name>', '<document-name>', '<attribute-name>', (select max(<legacy-column>) from <legacy-table>));
Related