HasSetCodes
You can use the HasSetCodes function to check whether an Optiva object is associated with one or more specified set codes. The set codes are used to classify, categorize, and group objects in Optiva.
When to use
You can use this function to:
- Validate whether an object belongs to the required set codes before processing.
- Check set code classifications during workflow automation.
When not to use
You cannot use this function to retrieve set code details for an object. This function is only to check whether the object belongs to specified set codes.
Syntax
long HasSetCodes(string objSymbol, string objKey, params string[] @params);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| objSymbol | string | Optional |
The symbol of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| objKey | string | Optional |
The key of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| @params [] | string | Optional | The variable-length parameter array containing one or more attribute values to check. You can pass the values as individual string arguments or as a string[] array. The function checks whether the object belongs to any of the specified set codes. |
Return Value
The application returns a value zero (0) if the object does not belong to the set code.
Prerequisites
- The object must exist and be accessible.
- The specified set code values must be valid.
Examples
- Example 1
-
Basic Set Codes check for current object of the workflow.
long hasset = HasSetCodes ("", "", "GLOBAL", "PATRIOTS", "CEREAL");
- Description
- This example checks if the current workflow object is assigned to set codes such as GLOBAL, PATRIOTS, CEREAL.
- Example 2
-
Verify whether a formula belongs to a particular set code.
public long wf_start() { long lSet = HasSetCodes("FORMULA", @"SPF45\0001.006", "WATERTEST"); if (lSet == 0L) { MessageList(@"SPF45\0001.006 not water tested. Workflow cancelled."); return 0L; } else { return 1L; } }
- Description
- 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.