Creating Specifications and Transactions
When creating variable specifications programmatically using SQL, data should not be inserted directly into the Var_Specs table. Instead, transactions should be created and then the Plant Applications transaction approval routine should be called. This is especially true when dealing with central specifications as the transaction approval routine will handle all the inheritance that is based on the characteristic tree and central to variable specification relationships.
The main data tables for transactions are:
Table Name | Description |
---|---|
Transactions | Transactions |
Transaction_Groups | Transaction groups |
Trans_Variables | Variable specification changes |
Trans_Products | Product to unit assignments |
Trans_Properties | Central specification changes |
Trans_Characteristics | Characteristic to product/unit assignments |
Trans_Char_Links | Characteristic tree |
An example of how to create and approve a transaction is as follows:
-- Create the transaction
EXEC spEM_CreateTransaction ‘My Transaction’, - Transaction description
NULL, -- Corporate transaction id,
1, -- Transaction type; corresponds to the Transaction_Type table
NULL, -- Corporate transaction description
1, -- User id
@Trans_Id OUTPUT
-- Fill out the transaction data tables
-- Approve the transaction
EXEC spEM_ApproveTrans @Trans_Id,
1, -- User id
1, -- Transaction group id
NULL, -- Deviation date
@ApprovedDate OUTPUT, -- Approved date
@Effective_Date OUTPUT -- Effective date