HasContextAttrib
You can use this function for Optiva Workflows and Copy Methods.
Purpose
This function checks for the presence of specific context attributes for an object and returns the number of attributes for the object.
Syntax
long HasContextAttrib(string objSymbol, string objkey, string AttribName, params string[] @params);
Return Value
The function displays a value zero (0) if the ContextAttrib are not assigned.
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 first attribute checks for the enumerated lists. These are the "C_" attributes. Use the entries from the Value column, not the Custom Description. | |
Description
This function checks for the assignment of a context attribute to an object. Returns the number of attributes to which the object is assigned.
Examples
This example checks that the item SAUCE has selling location ENGLAND. If not, a message is displayed to the user and the workflow is cancelled.
Dim lSell A Long = HasContextAttrib("ITEM","SAUCE","SELLOC", "ENGLAND")
if (lSell = 0) then
MessageList("This item can’t be sold in Asia. Workflow cancelled.")
Return 9111
else
return 111
end if
This example checks that the workflow object is assigned to the ACME brand. If not, the object is assigned to that brand.
Dim lBrand As Long = HasContextAttrib("","","C_BRAND","ACME")
if (lBrand = 0) then
Dim lAcme As Long = AddContextAttrib("","","C_BRAND","ACME")
end if
This example checks the product type of the workflow object. If it is a moisturizer, it is added to the CREAMS set code.
Dim lType As Long = HasContextAttrib("","","C_PRODTYPE", "MOISTURIZER")
if (lType = 1) then
Dim lSet As Long = AddSetCodes("","","CREAMS")
end if
Checks whether the ITEM 'SAUCE' has the selling location context attribute 'ENGLAND' assigned.
long hasca = HasContextAttrib("ITEM", "SAUCE", "SELLOC", "ENGLAND");
Checks if the current workflow object has context attributes of type "C_BRAND" (brand) with the values "TEST1" and "TEST2" assigned.
long hasca = HasContextAttrib("", "", "C_BRAND", "TEST1", "TEST2");