HasSetCodes

You can use this function for Optiva Workflows, Copy Methods, and Equations.

Purpose

Checks that an object is assigned to one or more set codes.

Syntax


Dim variable As Long = HasSetCodes(Symbol,Object,Code1,[Code2,...])

Arguments

Part Description
Symbol Type of object. Use empty quotation marks for the current symbol for the workflow.
Object Object for which to check set codes. Use empty quotation marks for the current object for the workflow.
Code1 The first set code to check.
Code2 Optional. Additional set codes to check.

Description

HasSetCodes checks whether the Symbol and Object belong to a list of set codes. The function returns the number of set codes to which the object belongs.

The function returns the number zero (0) to the variable if it does not belong to any of the sets; or it returns a number equal to the number of set code arguments it does belong to.

This function is used to ensure that a correct formula or item is in the workflow, copy method, or equation. For example, a formula for sun screen must be tested for its ability to perform after water contact. Establish a set code for sun screen formulas that have been tested. In a workflow for approving a new sun screen, use HasSetCodes. This function can check that the sun screen has been tested for water contact and cancel the workflow if it has not.

Examples

In this example, the Symbol and Object can be replaced by empty quotation marks to indicate the current values. If the Object is not a member of the set, then use a conditional statement and the AddSetCodes function to add it to the set.

For formulas and specifications, you must include a backslash (\) followed by a version number.


Dim lSet As Long = HasSetCodes ("FORMULA","PIZZASAUCE\003", 
"SAUCE","ICE_CREAM")

lSet = 1 PIZZASAUCE belongs to the SAUCE set, but not ICE_CREAM.


Dim lSet As Long = HasSetCodes("ITEM","TOMATOES", "NON_PERISHABLES")

lSet = 0 TOMATOES does not belong to a NON_PERISHABLE set.

In the next example, the formula for sun screen SPF45\0001.006 has not been tested. It does not belong to the WATERTEST set. The conditional statement ensures that the workflow is cancelled and the user is notified.


Dim lSet As Long = HasSetCodes("FORMULA","SPF45\0001.006", "WATERTEST")
if (lSet = 0) then
   MessageList("SPF45\0001.006 not water tested. Workflow cancelled.")
   Return 9111
else
   Return 111
end if