How to provide serial no in the reframework

Hi,
I have a build datatable in Reframework i checked the autoincrement check box so for each transaction it is starting with zero ,and for the new transaction it is again starting with zero, for the second transaction what it has to start as the continuation of the first. Can anyone please help me to solve this issue.

Hi @Chippy_Kolot

If that’s not working, you can think about this alternative approach as well:

→ Remove the autoincrement property from the Build Data Table activity & add a new integer variable (let’s call it transactionNumber) in the init all settings sequence.
→ In the place in your workflow where you start processing a new transaction, typically in the Process state of the State Machine, increment the transactionNumber variable by 1.
→ Pass the transactionNumber variable to the activity where you need to populate the autoincrement column of the data table. You can do this by passing it as an input argument to the workflow or by using the In/Out argument to share the variable across different workflow states.

Hope this helps,
Best Regards.

Hi @Chippy_Kolot

Can you try this approach-

  1. Define a queue to store the last used index:-
    Dim lastUsedIndex As New Queue(Of Integer)

  2. In the GetTransactionData state, retrieve the last used index from the queue, if any:
    If lastUsedIndex.Count > 0 Then
    transactionNumber = lastUsedIndex.Dequeue()
    Else
    transactionNumber = 1
    End If

  3. When creating a new DataRow in the ProcessTransaction state, use the last used index as the value for the auto-increment column:
    row(“ID”) = transactionNumber

  4. Increment the transaction number after each successful transaction:
    transactionNumber += 1

  5. Finally, store the last used index in the queue before ending the transaction:
    lastUsedIndex.Enqueue(transactionNumber)

Thanks!!