Note: This function is an Axeda ConnectedConfiguration feature. If the Axeda Platform is not licensed for ConnectedConfiguration, you will not have access to this function.
The CfgHas() function determines if any of the specified Path expressions match the defined "match" criteria provided by the function. When multiple identical Paths exist in the configuration, this function determines whether any, none, or all of the identical Paths’ values match the specified ‘match’ criteria depending on which match criteria was specified for the asset in the rule execution context. A model number and serial number may also be specified to perform this operation on a specific asset. The function returns Boolean.
Boolean CfgHas(String "path, String "matchValue", String "matchType")
where:
§ path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed.
§ matchValue -- value you want to match in the Path expression(s)
§ matchType (any/none/all) -- a literal string or an attribute; identifies how you want the server to perform the match operation for the related configuration item ("all" is the default). If there are multiple Path expressions in the configuration, this parameter determines whether any, none or all of the identical Paths’ values match the specified ‘matchValue’ criteria depending on which match criteria was specified
The following example determines if the model of the top motherboard provided in the Path expression is "Model123" and the model of the bottom motherboard provided in the Path expression is "Model321"
If:
CfgHas("/Config/Hardware/MotherBoard[0]/@position”, "top”) &&
CfgHas("/Config/Hardware/MotherBoard[0]/Model”, "Model123”) &&
CfgHas("/Config/Hardware/MotherBoard[1]/@position”, "bottom”) &&
CfgHas("/Config/Hardware/MotherBoard[1]/Model”,
"Model321”)> 0
The following example determines if the any of the models is "Model321":
If:
CfgHas("/Config/Hardware/MotherBoard/Model”, "321”, "any”)
Boolean CfgHas(String "path, String "matchValue", String "matchType", String "model", String "serial")
where:
§ path -- The path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed.
§ matchValue -- value you want to match in the Path expression(s)
§ matchType (any/none/all) -- a literal string or an attribute; identifies how you want the server to perform the match operation for the related configuration item ("all" is the default). If there are multiple Path expressions in the configuration, this parameter determines whether any, none or all of the identical Paths’ values match the specified ‘matchValue’ criteria depending on which match criteria was specified
§ model -- The model number of the asset configuration (Path) for this operation
§ serial -- The serial number of the asset configuration (Path) for this operation
The following example determines if the type of the modular Instruments for the ACME_Z asset (defined by model and serial number) is "Type123":
If: CfgHas("/DeviceSync/ManagedDevice/ModularInstrument/@type", "Type123","any", "modelXYZ", "serial123")
Notes on Rule Execution:
The Platform first compares the incoming configuration event with non-persisted configuration values. If the value is not found or if the path was specified for a different asset than the one in the current context of the event, then the Platform checks persisted (saved) values. The rule will NOT trigger if the Configuration event does not provide any paths that are used in the Expression rule.
If the rule does not evaluate, make sure the following are true: the Path exists as specified, you've used valid function argument types and the correct number of arguments, the asset you identified exists as specified (modelNumber/serialNumber). Also for CfgStrValue, CfgDoubleValue, CfgBooleanValue, CfgItem, CfgHas, CfgLongValue: the rule will not evaluate if multiple node/values are found for the specified path (with or without wildcard). Finally, if a rule defined with SetCfgValue action doesn't execute, make sure the SetCfgValue action path does not contain any trailing or leading wildcards ‘*’ .
The comparison value, which applies to matchValue strings, may be specified as a single value or a set of values. The set may be specified as an actual array (for example, ["US", "CA", "UK"]), or as a string that can be parsed into a set. When using the string format, the string must begin and end with either brackets [] or parenthesis (). Elements within the set are separated by commas. Elements containing commas may b wrapped with quotes. For example, "[CA, \"UK, US\"]" contains two elements: "CA" and "UK, US".
The following is an example of a CfgHas function that uses a set of values defined for matchValue:
CfgHas("/Config/Module@type", “[modA, modB, modC]”, "all")
When specifying a set as a comparison value, the matchType (all/any/none) instruction functions as follows:
o all -- True is returned if the set of elements that match the XPath argument in the asset's configuration contain ALL of the values in the set of values specified in the set, otherwise False is returned.
o any -- True is returned if the set of elements that match the XPath argument in the asset's configuration contain one or more of the values in the set of values specified in the set, otherwise False is returned.
o none -- True is returned if the set of elements that match the XPath argument in the asset's configuration contain none of the values in the set of values specified in the set, otherwise False is returned.