The AddConstraint method adds a PrecedenceConstraint object to a Step2 object.
Constraints.AddConstraint StepName
Part | Description |
---|---|
Constraints | Expression that evaluates to a PrecedenceConstraints collection |
StepName | Name of the step referenced by the precedence constraint |
StepName is not the name of the Step2 object to which the PrecedenceConstraint object is being added. It is the name of the step whose status or result determines when the Step2 object can be released for execution.
The AddConstraint method does not return a reference to the PrecedenceConstraint object it creates. You may need to set PrecedenceConstraint properties, PrecedenceBasis, or Value to other than their defaults. In this case, you can create the PrecedenceConstraint object with the New method, set the properties, and then add it to the collection with the Add method. Or, you can access the PrecedenceConstraint object from the collection after creating it with AddConstraint.
HRESULT AddConstraint(BSTR StepName);
This Microsoft® Visual Basic® sample accesses a PrecedenceConstraint object from the collection after creating it with AddConstraint:
objStep.PrecedenceConstraints.AddConstraint "StartStep"
Set objConstraint = objStep.PrecedenceConstraints( "StartStep" )