AddContextAttrib
You can use this function for Optiva Workflows and Copy Methods.
Purpose
The AddContextAttribs function assigns an Optiva object to one or more context attributes.
Syntax
long AddContextAttrib(string objSymbol, string objkey, string AttribName, params string[] @params)
Return Value
If the code is successful, a value greater than zero (0) is displayed.
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.
|
|
AttribName |
The name of attribute assigned to the context.
You can use these codes:
|
|
param1, param2 |
The objects are assigned to one or more context attributes. These values are defined in the Attribute specific Enumerated Lists. | |
Description
Use AddContextAttrib to assign context information to an object. It returns the number of attributes to which the object is assigned or zero for an error.
Examples
This example assigns selling locations CA, MA, and TN to formula PIZZASAUCE\003. These locations must already exist in the database.
Dim lSell As Long = AddContextAttrib("FORMULA", "PIZZASAUCE\003",
"SELLOC","CA", "MA","TN")
AddContextAttrib("FORMULA", "PIZZASAUCE\003", "SELLOC", "CA", "MA", "TN");
This example uses HasContextAttrib to check if the object of the workflow or new object is assigned to the FOOD end use. If not, it is assigned the context.
Dim lUse As Long = HasContextAttrib("","","C_ENDUSE","FOOD")
if (lUse = 0) then
Dim lAdduse As Long = AddContextAttrib("","", "C_ENDUSE","FOOD")
MessageList("This formula is for enduse: Food.")
end if
This example determines if the object of the workflow or new object is assigned to one of the pizza sets. If it is, the object is assigned to the end-use context attribute of the pizza.
Dim lSet As Long = HasSetCodes("","","MEAT","SAUCE","DOUGH")
if (lSet > 0) then
AddContextAttrib("","","C_ENDUSE","PIZZA")
end if
This example assigns end use (C_ENDUSE) with the code ENUSE_CODE to the current object/symbol.
AddContextAttrib("", "", "C_ENDUSE", "ENUSE_CODE");