Production Events

Order Field Name Values/Table Reference
0 Result Set Type 1
1 Result Set Order
2 Transaction Type
  • 1 = Add
  • 2 = Update
  • 3 = Delete
3 Event Id Events.Event_Id
4 Event Number Events.Event_Num
5 Unit Id
  • Events.PU_Id
  • Prod_Units.PU_Id
6 Timestamp Events.TimeStamp
7 Applied Product Events.Applied_Product
8 Source Event Events.Source_Event
9 Event Status Events.Event_Status
10 Confirmed
11 User Id
  • Users.User_Id
  • Events.User_Id
12 Update Type
  • 0 = Pre-Update
  • 1 = Post-Update
13 Conformance
14 TestPctComplete
15 Start Time Events.Start_Time
16 Transaction Number
17 Testing Status
18 Comment Id
  • Events.Comment_Id
  • Comments.Comment_Id
19 Event Sub Type Id
20 Entry TimeStamp Events.Entry_On

The genealogy is best done using the Genealogy Event Components result sets and tables. However, the Source_Event_Id field provides some functionality on its own. If the Source_Event_Id field is filled out and the parent event is deleted, then the child event will also be deleted automatically.

Example


DECLARE	@PUId	int,
                @EventStatus	int

DECLARE @Events TABLE (
ResultSetType	int DEFAULT 1,
Id	           int IDENTITY,
TransType	    int DEFAULT 1,
EventId	      int NULL,
EventNum	     varchar(50) NULL,
PUId	        int NULL,
TimeStamp	   varchar(50) NULL,
AppliedProduct     int NULL,
SourceEventId      int NULL,
EventStatus	 int NULL,
Confirmed	   int DEFAULT 1,
UserId	      int NULL,
PostUpdate	  int DEFAULT 0)

SELECT @PUId = PU_Id
FROM Prod_Units
WHERE PU_Desc = 'MyUnit'
SELECT @EventStatus = ProdStatus_Id 
FROM Production_Status
WHERE ProdStatus_Desc = 'Complete'
INSERT INTO @Events (   EventNum,
                        PUId,
                        TimeStamp, 
                        EventStatus)
VALUES ('ABC123',
       @PUId,
       convert(varchar(50), getdate(), 120), 
       @EventStatus)

-- Output results
SELECT	     ResultSetType, 
                 Id,
                 TransType, 
                 EventId, 
                 EventNum, 
                 PUId,
                 TimeStamp, 
                 AppliedProduct, 
                 SourceEvent, 
                 EventStatus, 
                 Confirmed, 
                 UserId, 
                 PostUpdate
FROM @Events 
ORDER BY Id ASC