Skip to Content

Auto numbering

  • Origin: Pre-population in Workflow

In order to pre-populate a certain field with the count of all IDs in the current app +1, thus, getting a unique consecutive number for an item (invoice no, request #, etc.), enter the following expression:

@prefix cmw: <>.
@prefix cmwmath: <>.
@prefix math: <>.
@prefix user: <>.
?item cmw:container ?container.
from {
?item1 cmw:container ?container.
?item1 user:w_maxId ?maxId.
} select ?maxId -> ?maxIds.
?maxIds cmwmath:max ?result.
(?result 1) math:sum ?value.