Reminder! Until the end of the month, our Learning Track over Advanced Normalization is unlocked and available to all Grooper xChange users!
Grooper 2.80.0043 is now available! Check the  Downloads Discussion for the release notes and to get the latest version.
Grooper 2.90.0051 is now available! 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: 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.