Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0044 is available as of 06-20-2024! Check the Downloads Discussion for the release notes and to get the latest version.
Grooper 23.1.0026 is available as of 09-16-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 24.0.0012 is available as of 10-10-2024! Check the Downloads Discussion for the release notes and to get the latest version.

How to keep BatchID consistent?

Currently in our data model has a field called BatchID and the value was populated with script "Folder.Batch.ID" at Default Value Expression. However, When the batch was spawned to new process then the Batch got a new BatchID. At first we tried to use the batch name but the batch name can be duplicates.

Is there a way to keep track of the batch with unique identifier?

Thanks
Tagged:

Answers

  • strotellistrotelli Posts: 42 admin
    Yes use a batch processing script to assign the value without the default value expression. 

    Here is an example of what it should look like 

      Private Sub BatchProcess_BatchCompleted(sender As Object, e As BatchProcess.BatchCompletedEventArgs) Handles BatchProcess.BatchCompleted
            Select Case e.StepCompleted.Name
                Case "Scan"
                    Try
                        Dim CurBatch As Batch = e.Batch
                        Dim myFolder As BatchFolder = CurBatch.BatchRoot
                        Dim di As DocumentInstance = myFolder.IndexData
                        Dim fi As FieldInstance = di.Fields("Batch_ID")
                        e.Batch.Name = e.Batch.Name + " " + e.Batch.Id.ToString
                        fi.Value = "hello"
                        fi.Root.Database.SaveChanges()

                    Catch ex As Exception

                        Grooper.WriteToEventLog(EventLogEntryType.Error, ex.Message, e.Batch)
                    End Try
  • DungVuDungVu Posts: 88
    Stotelli, Should I put script in an unattanded activity?
  • DungVuDungVu Posts: 88
    I put the script in the ProcessingScript but my index data is not updated with new value using fi.value = "Hello"
  • DungVuDungVu Posts: 88
    Can I run update the Index data field with the new value within the process script? Do I need to use the Data Instances? Please give me some direction how to build this. Thanks
Sign In or Register to comment.