The next version of Grooper - Grooper 2021 - will be entering beta soon! If you want to get a head start on some of our exciting new features, check out the  article over Smart PDFs  on the Grooper Wiki!

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: 40 mod
    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: 65
    Stotelli, Should I put script in an unattanded activity?
  • DungVuDungVu Posts: 65
    I put the script in the ProcessingScript but my index data is not updated with new value using fi.value = "Hello"
  • DungVuDungVu Posts: 65
    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.