HasContextAttrib

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

Purpose

Checks for the presence of specific context attributes for an object and returns the number of attributes for the object.

Syntax


Dim variable As Long = HasContextAttrib(Symbol, Object, AttribCode, Value1 [, Value2,...])

Arguments

Part Description
Symbol Type of object, such as formula or item. Use empty quotation marks to indicate the current symbol for the workflow or new symbol for the copy method.
Object Object for which to check context attributes. Use empty quotation marks to indicate the current object for the workflow, or new object for the copy method.
AttribCode The type of attribute to check for the context. Use these codes:
  • C_BRAND- brand
  • C_PRODTYPE - product type
  • SELLOC - selling location
  • MFGLOC - manufacturing location
  • C_ENDUSE - end use
  • C_ENDUSER - end user
Value1 The first attribute checks for the enumerated lists. These are the "C_" attributes. Use the entries from the Value column, not the Custom Description.
Value2, ... Optional. Additional attributes to check.

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