How to generate unique Number for documents?

Hi,
How to get unique number for every document in the batch?

Example:-
Batch1:
           Document1: 001
           Document2: 002
           Document3: 003
Batch2:
           Document1: 004
           Document2: 005
           Document3: 006

Thanks & Regards,
Saisreenadh

Answers

  • GrooperGuruGrooperGuru Posts: 442 admin
    In a Calculate or Export Mapping Expression, you can use NodeIndex to obtain the position of the current document within its parent container. This use zero-based indexing. This gets you close to what you need, but the numbering would essentially start over for every batch or parent folder you encounter. For something that will continue a sequence across parent documents or batches, I would see this more being a function of a destination database with an identity column that inserts the next available number upon export of a new row. 
    Matt Harrison
    Director of Strategy
    [email protected]
  • dgreenwooddgreenwood Posts: 52 admin
    You could also do this with a GUID if you're just wanting a unique ID for each document.  Every object in Grooper has a GUID already assigned to it.  One option would be to just use the GUID assigned to the document folder in the Batch.

    You could create a Data Field in your Data Model and use the "Default Value Expression" property to create a simple expression returning the document folder's GUID.  That expression is as follows:

    Folder.Id

    You could also generate a new random GUID using the following Default Value Expression:

    Guid.NewGuid
  • SaisreenadhSaisreenadh Posts: 13
    Hi @GrooperGuru@dgreenwood,

    Thanks you. But, we want unique sequence number not GUID. Is there any possibility to use SQL sequence or stored procedure to get sequence number in Grooper.

    Thanks & Regards,
    Saisreenadh
  • GrooperGuruGrooperGuru Posts: 442 admin
    @Brian any ideas on this one?
    Matt Harrison
    Director of Strategy
    [email protected]
Sign In or Register to comment.