Batch
In Relativity, a system admin creates a batch by splitting a static set of documents into multiple sets based on the criteria for a review. For more information, see on the Relativity Documentation site.
The Services API supports read, update, delete, and query operations on the Batch DTO.
Note: You can also update and read batches using the single-artifact access methods common to all Relativity DTOs. For more information, see Single-artifact access.
This page contains the following information:
Update and read a Batch
When you update a Batch object, you can modify only the AssignedTo and BatchStatus properties. This code samples illustrates how to modify these properties using the Update() method on the Batch repository.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | public static bool Batch_Update_Using_Repository(IRSAPIClient proxy) { // STEP 1: Create an object specifying the Artifact ID // and the fields that you want returned. DTOs.Batch batch1 = new DTOs.Batch(1036607); batch1.Fields = FieldValue.AllFields; // STEP 2: Read current values. ResultSet<DTOs.Batch> results = new ResultSet<DTOs.Batch>(); try { results = proxy.Repositories.Batch.Read(batch1); } catch (Exception ex) { Console.WriteLine( string .Format( "An error occurred: {0}" , ex.Message)); return false ; } if (!results.Success) { Console.WriteLine( "Error: " + results.Message); return false ; } // STEP 3: Get the Artifact from the read results. DTOs.Batch batch2 = results.Results.FirstOrDefault().Artifact; Console.WriteLine( "Batch Artifact ID: " + batch2.ArtifactID.ToString()); Console.WriteLine( "Batch Text Identifier: " + batch2.TextIdentifier); Console.WriteLine( "Batch Status ID: " + batch2.BatchStatus.Name + ", ID: " + batch2.BatchStatus.ArtifactID.ToString()); Console.WriteLine( "Batch Assigned To: " + batch2.AssignedTo.FullName + ", ID: " + batch2.AssignedTo.ArtifactID.ToString()); // STEP 4: Modify properties of the Batch. // For a Batch, you can only modify the AssignedTo and BatchStatus properties. batch2.BatchStatus = new DTOs.Choice(1035249); batch2.AssignedTo = new DTOs.User(1016508); // STEP 5: Call the Update() method on the Batch repository. WriteResultSet<DTOs.Batch> writeResultSet = null ; try { writeResultSet = proxy.Repositories.Batch.Update( new List<DTOs.Batch> { batch2 }); } catch (Exception ex) { Console.WriteLine( string .Format( "An error occurred: {0}" , ex.Message)); return false ; } if (writeResultSet.Success) { Console.WriteLine( "Batch updated successfully" ); batch2 = results.Results.FirstOrDefault().Artifact; Console.WriteLine( "Batch Artifact ID: " + batch2.ArtifactID.ToString()); Console.WriteLine( "Batch Text Identifier: " + batch2.TextIdentifier); Console.WriteLine( "Batch Status ID: " + batch2.BatchStatus.ArtifactID.ToString()); Console.WriteLine( "Batch Assigned To ID: " + batch2.AssignedTo.ArtifactID.ToString()); } else { string message = writeResultSet.Message; if (message == null && writeResultSet.Results.Count > 0 && !writeResultSet.Results[0].Success) message = writeResultSet.Results[0].Message; Console.WriteLine( "Error: " + message); return false ; } // STEP 6: Read back the updated Artifact. try { results = proxy.Repositories.Batch.Read(batch2); } catch (Exception ex) { Console.WriteLine( string .Format( "An error occurred: {0}" , ex.Message)); return false ; } if (!results.Success) { Console.WriteLine( "Error: " + results.Message); return false ; } // STEP 7: Get the updated property values from the read results. DTOs.Batch batch3 = results.Results.FirstOrDefault().Artifact; Console.WriteLine( "Batch Artifact ID: " + batch3.ArtifactID.ToString()); Console.WriteLine( "Batch Text Identifier: " + batch3.TextIdentifier); Console.WriteLine( "Batch Status: " + batch3.BatchStatus.Name + ", ID: " + batch3.BatchStatus.ArtifactID.ToString()); Console.WriteLine( "Batch Assigned To: " + batch3.AssignedTo.FullName + ", ID: " + batch3.AssignedTo.ArtifactID.ToString()); return true ; } |
Query for a Batch
To query for a Batch, you can use the fields listed in the following table. For more information, see Search Relativity.
Fields for Batch queries | |
---|---|
ArtifactID | Batch Size |
Assigned To | Batch Status |
Batch | Batch Unit |
Batch Set | Reviewed |
This code sample illustrates how to set query conditions, call the Query() method on the Batch repository, and iterate through the result set.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | public static bool Batch_Query_By_BatchSet_Using_Repository(IRSAPIClient proxy) { // STEP 1: Create criteria that identifies a BatchSet object. WholeNumberCondition criteria = new WholeNumberCondition(BatchFieldNames.BatchSet, NumericConditionEnum.EqualTo, 1036606); // STEP 2: Create a query that uses your criteria. DTOs.Query<DTOs.Batch> query = new DTOs.Query<DTOs.Batch>(); query.Condition = criteria; query.Fields = FieldValue.AllFields; // STEP 3: Call the Query() method on the Batch repository. QueryResultSet<DTOs.Batch> result = null ; try { result = proxy.Repositories.Batch.Query(query); } catch (Exception ex) { Console.WriteLine( string .Format( "An error occurred: {0}" , ex.Message)); return false ; } Console.WriteLine( string .Format( "Number of batches returned: {0}" , result.Results.Count)); // STEP 3: Iterate through returned the results. foreach (DTOs.Result<DTOs.Batch> batchResult in result.Results) { DTOs.Batch batch = batchResult.Artifact; Console.WriteLine( "Batch Name: " + batch.Name); Console.WriteLine( "Batch Artifact ID: " + batch.ArtifactID); } return true ; } |