Result Set 2 - Variable Values

The following table lists the parameters used in a Variable Result Set.

Order

Field Name

Req

Values/Table Reference

0

Result Set Type

X

2

1

Variable Id

X

Tests (Var_Id)

2

Production Unit Id

X

Variables (PU_Id)

Prod_Units (PU_Id)

3

User Id

X

Tests (User_Id)

Users (User_Id).  Allows a specific User_Id to be used and tracked.  If not using a specific User_Id account then set it to 0 and the appropriate Service User_Id will be used.

4

Cancelled

X

0 – False

1 – True

If set to True then it is treated like a delete.

5

Value

X

Tests (Result)

6

Timestamp

X

Tests (Result_On)

7

Transaction Type

 

1 – Add, 2 – Update, 3 - Delete

8

Update Type

 

0 – Pre Update.  Database Manager writes to db and sends to client.

1 – Post Update.  Data already in db and sent to clients only.

NOTE: PostDB messages do not support comment IDs.

9

SecondUserId

 

 

10

TransNum

 

0 = Coalesce all input values with values from database before updating

2 = Update database using only input values to this stored procedure

11

EventId

 

Events (Event_Id)

12

ArrayId

 

Array_Data (Array_Id)

13

CommentId

 

Tests (Comment_Id)

14

ESignature

 

Signature ID from the ESignature table

See Also

Partial Example Code for Using Result Set 2

--Declare the SQL variables used

Declare

@VUVar_Id int,

@VUPU_Id int,

@VUUser_Id int,

@VUCanceled int,

@VUResult Varchar(25),

@VUResult_On varchar(25),

@VUTransaction_Type int,

@VUPostUpdate int

--Create a temporary table to hold all variable result set rows

CREATE TABLE #VariableUpdates (

  VUVar_Id int,

  VUPU_Id int,

  VUUser_Id int,

  VUCanceled int,

  VUResult Varchar(25),

  VUResult_On datetime,

  VUTransaction_Type int,

  VUPostUpdate int)

--Set Result Set Variables to values retrieved in your custom code.  No specific custom code is being show.

Select @VUVar_Id = Var_Id

  from Variables where PU_Id = @PU_Id And Var_Desc Like '%Remaining%'

Select @VUPU_Id = @PU_Id

Select @VUUser_Id = 0

Select @VUCanceled = 0

Select @VUResult = @Value

Select @VUResult_On = @Timestamp

Select @VUTransaction_Type = 1

Select @VUPostUpdate = 0

 

Insert into #VariableUpdates (VUVar_Id,VUPU_Id,VUUser_Id,VUCanceled,VUResult,VUResult_On,VUTransaction_Type,VUPostUpdate)

Values(@VUVar_Id,@VUPU_Id,@VUUser_Id,@VUCanceled,@VUResult,@VUResult_On,@VUTransaction_Type,@VUPostUpdate)

 

If (Select Count(*) From #VariableUpdates) > 0

  Select 2,* from #VariableUpdates