1
0
-1

Hi Team,

We need to create a Receipt number service to generate below format and need reset form next sequence no to 1 every midnight using some other schedule service.

Ref+todate(DDMMYY)+formnextsequenceNo(6charectors)

Eg: REF220316000001

We manage to get the form next sequence no created reference no.

FormReceiptSequenceDao formRecieptDao = new FormReceiptSequenceDao();       

def sequence = formRecieptDao.getCurrentReceiptSequenceNumber(form);

But how do we reset the value to 1 in schedule service?

We tried below but throwing below error message.

FormReceiptSequence recSeq = new FormReceiptSequence(); recSeq.setForm(myFormDao.getFormByFormCode("FORMCODE"));

 recSeq.setSequenceNumber(1);

Cannot insert duplicate key row in object 'dbo.form_receipt_sequence' with unique index 'ui_form_receipt_sequence'. The duplicate key value is (72).

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Maseer,

       

      A sequence is automatically created for each new form that is deployed in TM. The sequence cannot be reset to ensure uniqueness of all form submissions for a form. 

      The only way to start with a new sequence is to deploy the form with a new form code.

        CommentAdd your comment...