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.
CfgNumItems() determines how many configuration items exist in the related asset configuration. This function can operate on the asset in scope or it can be specified to operate on another, specified asset. See ConnectedConfiguration functionality for more information.
CfgNumItems() function determines how many entries exist for the specified Path based on the configuration items for the asset in context. Returns Integer.
Integer CfgNumItems(String "path")
where:
path -- The Path to search. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path of the asset in scope for the expression rule is used
The following example determines if less than 3 configuration items are defined in the specified Path for the asset in scope. If so, an Audit message is created.
If: CfgNumItems("/DeviceSync/ManagedDevices/ManagedDevice/ModularInstrument/Module/@type") <= 3
Then: Audit("data-management", "ACME123 Instrument is reporting the wrong number of items")
CfgNumItems() can also operate on a specified asset, rather than the asset in scope.
Integer CfgNumItems(String "path", String "modelNumber", String "serialNumber")
where:
path -- The Path to search. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path of the specified asset is used.
modelNumber -- The model of the asset for this comparison
serialNumber-- The serial number of the asset for this comparison
The following example determines if more than one"type" module is defined for the specified asset (as defined by model and serial number). If so, then the server creates an audit message.
If: CfgNumItems("/DeviceSync/ManagedDevices/ManagedDevice/ModularInstrument/Module/@type", "modelXYZ", "serial123") > 1
Then: Audit("data-management", "Instrument is reporting more than one "type" modules)
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 ‘*’ .