DataEntry.ApproveSample
Syntax | Parameters | Return Value |
---|---|---|
Sub DataEntry.ApproveSample( _ SampleID As Integer, _ Status As SampleApprovalStatus, _ Comment As String, _ ByUser As Variant) |
The sample to approve. Type: Integer The approval status. Type: SampleApprovalStatus Any comments about the sample that the approver may have. Type: String The user that is approving the sample. Type: Variant |
This function does not return a value. |
SVB Example
Data Entry Example 4: Entering data samples:
Sub Main Dim oOM As New ObjectManager 'Reconnect into Enterprise oOM.Reconnect Application 'Create a new sample for the "Bread Measurements" data entry setup. 'First, we set the operator to "Blake". 'Then, we set the sample's label (bakery name) to "Vandalia". 'Note that we could set the operator to the user running this script by 'using the oOM.CurrentUser property; however, for this example will explicitly 'reference the user "Blake". Dim newSample As SampleData Set newSample = oOM.DataEntry.NewSample( _ oOM.Profiles("/Blake's Materials/Bread Measurements"), oOM.Users("Blake"), "") newSample.SampleLabelData.Add(oOM.Labels("/Blake's Materials/Bakeries"), "Vandalia") 'Now, add pieces (in this example, bread mixture measurements) to the sample Dim thePiece As SamplePiece Set thePiece = newSample.Pieces.Add 'Add the characteristic (the grain level measurement) thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 3 'Add the piece label (baker's name) thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Gabi" 'Add four more measurements the same way... Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 6 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Nancy" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 5.5 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Isabelle" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 7 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Maddie" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 6 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Blake" 'Save the sample newSample.Save 'We have all five entries in our sample now, so mark it as complete oOM.DataEntry.CompleteSampleByUser(newSample.Parent.ID, swcSampleCompleted, oOM.Users("Blake")) 'Approve the sample with the "Blake" user (who should have Admin rights). 'Note that he is adding a disapproving comment about Gabi's mixture. oOM.DataEntry.ApproveSample(newSample.Parent.ID, swcSampleApproved, _ "Speak to Gabi about her mixture's grain levels.", oOM.Users("Blake")) 'SAMPLE #2 'Let's add another sample, this time for the Huber Heights location Set newSample = oOM.DataEntry.NewSample( _ oOM.Profiles("/Blake's Materials/Bread Measurements"), oOM.Users("Blake"), "") newSample.SampleLabelData.Add(oOM.Labels("/Blake's Materials/Bakeries"), "Huber Heights") Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 3 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Gabi" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 5.2 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Mizzie" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 4.5 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Luna" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 8 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Angel" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 7 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Salem" newSample.Save oOM.DataEntry.CompleteSampleByUser(newSample.Parent.ID, swcSampleCompleted, oOM.Users("Blake")) 'Blake is now approving the sample, while again noting an issue with Gabi's bread mixture. 'It should be noted that he entered the same baker in two samples 'from two different bakeries--perhaps Blake is the one making the mistakes? oOM.DataEntry.ApproveSample(newSample.Parent.ID, swcSampleApproved, _ "Another suspect mixture from Gabi.", oOM.Users("Blake")) 'SAMPLE #3 'Let's add one more sample, this time for the Kettering location Set newSample = oOM.DataEntry.NewSample( _ oOM.Profiles("/Blake's Materials/Bread Measurements"), oOM.Users("Blake"), "") newSample.SampleLabelData.Add(oOM.Labels("/Blake's Materials/Bakeries"), "Kettering") Set thePiece = newSample.Pieces.Add 'Note the clearly wrong value of 30 entered here. This will come into play in later examples. thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 30 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Gabi" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 6 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Max" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 5.5 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Morgan" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 7 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Toby" Set thePiece = newSample.Pieces.Add thePiece.AddCharacteristicData(oOM.Characteristics("/Blake's Materials/Grain Level")).Value = 6.5 thePiece.AddLabelData(oOM.Labels("/Blake's Materials/Bakers")).Value = "Austin" newSample.Save oOM.DataEntry.CompleteSampleByUser(newSample.Parent.ID, swcSampleCompleted, oOM.Users("Blake")) 'Blake is now approving the sample, while again noting an issue with Gabi's bread mixture. 'Once again, he has entered the same baker in another sample 'from a different bakery (and with an extremely out-of-range value). 'Perhaps Blake will be the one being reviewed later? oOM.DataEntry.ApproveSample(newSample.Parent.ID, swcSampleApproved, _ "Another bad mixture from Gabi!!! Requesting full review of her work!", oOM.Users("Blake")) oOM.Disconnect End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.