AddSetCodes
You can use the AddSetCodes function to assign one or more set codes to an Optiva object. This function associates predefined set codes with an object for categorisation, classification, filtering, grouping and organising the data in Optiva.
When to use
You can use this function when:
- The objects need to be tagged with business classification codes or set codes.
- Assigning multiple set codes to an object in a single operation.
- Assigning set codes programmatically during workflow automation.
When not to use
You cannot use this function if:
- The set code must be validated before assignment. You can use a validation function to verify that the set code exists.
- The specified set codes are not predefined in the application configuration.
Syntax
long AddSetCodes(string objSymbol, string objKey, params string[] @params)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| objSymbol | string | Yes |
The symbol of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| objKey | string | Yes |
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 that has one or more set codes to assign.
Note:
|
Return Value
The application returns a value greater than zero (0) if the set code is added successfully.
Prerequisites
- The set codes must be predefined and active in the application configuration.
- The object must exist and be accessible in the current context.
Examples
- Example 1
-
Basic Usage
AddSetCodes("FORMULA", "PIZZASAUCE\003", "SAUCE", "PIZZA");
- Example 2
-
Current Object Assignment
AddSetCodes("", "", "REVIEWED", "PRODUCTION_READY");
- Description
-
Assigns "REVIEWED" and "PRODUCTION_READY" set codes to the current workflow object.
- Example 3
-
Single Category Assignment
AddSetCodes("ITEM", "SUGAR_001", "INGREDIENT");
- Description
- Categorizes item "SUGAR_001" with the "INGREDIENT" set code.
- Example 4
-
Copy Method Example
long lSet4 = CopyMethod.Context.GetSegData(4); long lSet5 = CopyMethod.Context.GetSegData(5); long rc = AddSetCodes("", "", lSet4, lSet5);
- Description
- You can construct a copy method where the user selects one or more sets to assign the new object. This example assumes that the fourth and fifth Auto Code segments allow the user to select from a list of sets.