Exercise 6: Batch Type Spec

The Batch Type Spec ties all of the other Batch Specs together. It must be loaded last since it references the IDs of all of the other specs that make up the batch. A DependencyList at the top of the spec lists the specs that should be loaded within the database prior to the loading of the Batch Type Spec. The CatalogItemID attribute value within the AddRowDataFormTemplate element refers to the ID of the Batch Add Row Data Form (AddDataFormTemplateSpec).

Warning: You may know that you typically refer to data forms from other specs such as Page Specs or Task Specs by its DataFormInstanceID; however, when you refer to a Data Form Spec within the Batch Type Spec you should refer to the spec's ID attribute.

The CatalogItemID attribute value within the EditRowDataFormTemplate element refers to the ID of the Batch Edit Row Data Form (EditDataFormTemplateSpec).

The CommitRowDataForms parent element can contains a CommitRowAddDataFormTemplate element and a CommitRowEditDataFormTemplate element. The data forms referenced by the CommitRowAddDataFormTemplate element and a CommitRowEditDataFormTemplate element indicate the data forms used to transfer the data from batch staging tables to production tables. The CommitRowAddDataFormTemplate adds/inserts new rows to the production table, while the CommitRowEditDataFormTemplate edits/updates existing rows within the production table. In the BatchTypeSpec example below for the Food Item Add Batch, the CommitRowDataForms parent element contains only the CommitRowAddDataFormTemplate that indicates this batch is used to add rows to the USR_FOODITEM table and not update rows.

The BatchDeleteRowRecordOperationelement points to the Record Operation Spec that deletes rows from the batch.

Step 1 -  Review the BatchTypeSpec below.

Use the example spec below as a guide and review your dependencies for the following specs:

<BatchTypeSpec
    xmlns:common="bb_appfx_commontypes"
    ID="5ad654f2-d64d-4f35-86dc-4742ab93fe5e"
    Name="Food Item Add Batch"
    Description="Batch type for adding food item records."
    Author="Technical Training"
    BaseTableName="USR_BATCHFOODITEMADD"
    Category="Food Item"
    xmlns="bb_appfx_batchtype">

  <common:DependencyList>
    <common:Dependency CatalogAssembly="Blackbaud.CustomFx.BatchTraining.Catalog.dll"
                       CatalogItem="Blackbaud.CustomFx.BatchTraining.Catalog.FoodItemAddBatch.Add.xml" />
    <common:Dependency CatalogAssembly="Blackbaud.CustomFx.BatchTraining.Catalog.dll" 
                       CatalogItem="Blackbaud.CustomFx.BatchTraining.Catalog.FoodItemAddBatch.Edit.xml" />
    <common:Dependency CatalogAssembly="Blackbaud.CustomFx.BatchTraining.Catalog.dll" 
                       CatalogItem="Blackbaud.CustomFx.BatchTraining.Catalog.FoodItemAddBatchDelete.RecordOperation.xml" />
    <common:Dependency CatalogAssembly="Blackbaud.CustomFx.BatchTraining.Catalog.dll" 
                       CatalogItem="Blackbaud.CustomFx.BatchTraining.Catalog.FoodItemAddBatchCommit.Add.xml" />
  </common:DependencyList>

  <AddRowDataFormTemplate CatalogItemID="cd2f3971-5b17-4b97-8b7f-1f2dbcfddfea" />
  <EditRowDataFormTemplate CatalogItemID="e3402fc1-6783-4003-8853-89ca2b90a2cc" />

  <CommitRowDataForms>
    <CommitRowAddDataFormTemplate CatalogItemID="96d20428-a73d-44a7-ac74-44a75bfada37"     />
  </CommitRowDataForms>

  <BatchDeleteRowRecordOperation CatalogItemID="42b3c606-57ff-4ec1-9cf7-3fb2875471f2" />
</BatchTypeSpec

Step 2 -  Load the batch specs in the appropriate order.

After the Batch Type Spec is complete, we can use LoadSpec to load the dependent specs into the database. Make sure the following specs are loaded prior to loading the BatchTypeSpec.