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.
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.
Can you try this approach-
-
Define a queue to store the last used index:-
Dim lastUsedIndex As New Queue(Of Integer) -
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 -
When creating a new
DataRow
in theProcessTransaction
state, use the last used index as the value for the auto-increment column:
row(“ID”) = transactionNumber -
Increment the transaction number after each successful transaction:
transactionNumber += 1 -
Finally, store the last used index in the queue before ending the transaction:
lastUsedIndex.Enqueue(transactionNumber)
Thanks!!