CfgItem() 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.

This function will perform operations on a Configuration Item for a specified actual asset configuration (Path expression). The actual nature of the operation depends on the values passed to the function. The CfgItem function returns String.

Get value of configuration item as String

This function will return the current value of a specified configuration item in the Path of the asset in the rule execution context:

Format:

String CfgItem(String "path", String "value")

where:

path -- The Path defined for this operation. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path of the related asset is used.

value- a literal string or an attribute; identifies that you want to return the current value for the related configuration item

Example:

The following example determines if the actual configuration for the asset in expression rule scope defines a value of "172.16.254.1" for the ipAddress configuration item. An audit message is created with the results of the comparison.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@ipAddress", "value") != "172.16.254.1"

Then: Audit("data-management", "ACME123 has the wrong IP address")

 

Get previous value of configuration item

This function will return the previous value of a specified configuration item in the Path of the specified asset.

Format:

String CfgItem(String "path", String "value", String "modelNumber", String "serialNumber")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

value- a literal string or an attribute; identifies that you want to return the previous value for this item

modelNumber -- The model of the asset configuration (Path) for this operation

serialNumber-- The serial number of the asset configuration (Path) for this operation

Example:

The following example determines if the previous actual configuration for the asset (defined by model and serial number) defined a value of "172.16.254.1" for the ipAddress configuration item. An audit message is created with the results of the comparison.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@ipAddress", "value", "modelXYZ", "serial123") == "172.16.254.1"

Then: Audit("data-management", "The previous IP address for ACME123 was 172.16.254.1")

Else: Audit("data-management", "The previous IP address for ACME123 was incorrect")

 

Get age of value for configuration item (persisted value)

For asset in rule execution

This function will return the age (in seconds since 1970 Unix Epoc) of the value of the related configuration item for the actual configuration of the asset in the rule execution context. This is the date when the value was persisted, as opposed to any valued defined and not yet persisted (that is, in memory only).

Format:

String CfgItem(String "path", String "age")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

age- a literal string or an attribute; identifies that you want to return the age of the current value for this configuration item

Example:

The following example determines if the value of the configuration item "make" was not changed on Tuesday, 15 Nov 2011 17:02:08 GMT. If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@make", "age") != "1321376528"

Then: Audit("data-management", "The make the asset was not correctly modified in the update performed on Tuesday, 15 Nov 2011 17:02:08 GMT.")

For a specified asset

This function will return the age of the value (in seconds since 1970 Unix Epoc) for a specified asset. This is the date when the value was persisted, as opposed to any valued defined and not yet persisted.

Format:

String CfgItem(String "path", String "age", String "modelNumber", String "serialNumber")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

age- a literal string or an attribute; identifies that you want to return the age of the current value for this configuration item

modelNumber -- The model of the asset configuration (Path) for this operation

serialNumber-- The serial number of the asset configuration (Path) for this operation

Example:

The following example determines if the value of "make" for the ACME_Z asset (defined by model and serial number) was not changed on Tue, 15 Nov 2011 17:02:08 GMT. If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@make", "age", "modelXYZ", "serial123") != "1321376528"

Then: Audit("data-management", "The make of ACME123 was not correctly modified in the update performed on Tuesday, 15 Nov 2011 17:02:08 GMT.)

 

Compare inflight value to persisted value

For asset in rule execution

This function will determine if the in-flight (non-persisted) updated value for the specified configuration item differs from the existing persisted value for the configuration item for the asset in the rule execution context.

Format:

String CfgItem(String "path", String "changed")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

changed- a literal string or an attribute; identifies that you want to determine if the current, inflight value is different from the current, persisted value for the related configuration item.

Example:

The following example determines if the current, inflight value of the configuration item "make" for the asset in expression rule in scope is different from the persisted value for "make". If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@make", "changed")

Then: Audit("data-management", "The current value for make is different from the saved value for make")

For a specified asset

This function will determine if the in-flight (non-persisted) updated value for the defined configuration item differs from the persisted value for the item corresponding to the specified model and asset number.

Format:

String CfgItem(String "path", String "changed", String "modelNumber", String "serialNumber")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

changed- a literal string or an attribute; identifies that you want to determine if the current, inflight value is different from the current, persisted value for the related configuration item.

modelNumber -- The model of the asset configuration (Path) for this operation

serialNumber-- The serial number of the asset configuration (Path) for this operation

Example:

The following example determines if the current, inflight value of configuration item "make" for the ACME_Z asset (defined by model and serial number) is different from the persisted value for "make". If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/@make", "changed", "modelXYZ", "serial123")

Then: Audit("data-management", "The current make of ACME_Z is different from the saved value for make.")

 

Get timestamp of configuration item

For asset in rule execution

This function will return the timestamp of the specified configuration item, in seconds since 1970 Unix Epoc, for the asset in the rule execution context.

Format:

String CfgItem(String "path", String "time")

where:

path -- The Path defined for this comparison. Trailing or leading Asterisk (*) wildcards are allowed. Optional. If not defined, the Path in scope is used.

time - a literal string or an attribute; identifies that you want to get the time when the configuration item was last modified

Example:

The following example determines if the timestamp for the configuration item "type" for the asset in expression rule scope is less than 1321376528 (or Tuesday, 15 Nov 2011 17:02:08 GMT) If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/Module/@type", "time") < "1321376528"

Then: Audit("data-management", "The modular type has not been changed since before Tuesday, 15 Nov 2011 17:02:08 GMT")

For a specified asset

This function will return the timestamp of the configuration item in seconds since 1970 Unix Epoc for the configuration item corresponding to the specified Path and asset (defined by model and serial number).

Format:

String CfgItem(String "path", String "time", String "modelNumber", String "serialNumber")

where:

path -- The Path defined for this comparison. Optional. If not defined, the Path in scope is used.

time - a literal string or an attribute; identifies that you want to get the time when the configuration item was last modified

modelNumber -- The model of the asset configuration (Path) for this operation

serialNumber-- The serial number of the asset configuration (Path) for this operation

Example:

This function will return the timestamp of the configuration item in seconds since 1970 Unix Epoc for the configuration item corresponding to the specified Path and asset (defined by model and serial number).

The following example determines if the value of the configuration item "type" for this asset (defined by model and serial number) was changed before "Tuesday, 15 Nov 2011 17:02:08 GMT". If true, then the server creates an audit message.

If: CfgItem("/DeviceSync/ManagedDevice/ModularInstrument/Module/@type", "time", "modelXYZ", "serial123") < "1321376528"

Then: Audit("data-management", "The modular type of the ACME_Z asset has not been changed since before Tuesday, 15 Nov 2011 17:02:08 GMT")

Notes on Rule Execution: