HasSetCodes

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

Purpose

The function HasSetCodes checks whether an object is assigned to one or more set codes.

Syntax


long HasSetCodes(string objSymbol, string objkey, params string[] @params)

Return Value

The function displays a value zero (0) if the object does not belong to the set code.

Arguments

Part Description
objSymbol The object type or current object type of the data.
Note: Use empty quotation marks to indicate the current symbol of the workflow.
objkey The object key or current object key of the data.
Note: Use empty quotation marks to indicate the current symbol of the workflow.
params The one or more set codes to be checked within the object.

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

Checks whether the current workflow object is assigned to set codes - GLOBAL, PATRIOTS, CEREAL

long hasset = HasSetCodes ("", "", "GLOBAL", "PATRIOTS", "CEREAL");