CfgHas() Function

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.

Operating on the asset in context

Format:

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

Examples:

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”)
 

Operating on a specific asset

Format:

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

Example:

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:

 

Specifying a Set as a Comparison Value (specific asset or asset in context)

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.