The "onChangeTrigger" property specifies when the connector saves collected tags to an integration table.
It is an enumerated string with the following values:
-
"saveWhenAnyTagHasChanged"(default)- The connector saves tags when at least one tag value collected by the connector has changed from its previous value.
-
"saveWhenAllTagsHaveChanged"- The connector saves tags when all tag values collected by the connector have changed from their previous value.
-
"saveWhenAnySpecifiedTagHasChanged"- The connector saves tags when at least one collected tag included in the
"onChangeTriggerTags"property has changed from its previous value.
- The connector saves tags when at least one collected tag included in the
-
"saveWhenAllSpecifiedTagsHaveChanged"- The connector saves tags when all collected tags in the
"onChangeTriggerTags"property have changed from their previous value.
- The connector saves tags when all collected tags in the
Use cases
- When you want to ensure collected data is persisted any time a tag value has changed, use
"saveWhenAnyTagHasChanged". This is the default because it ensures no data changes are lost. - When you want to ensure each record in an integration table contains no repeated values compared to the previous record, you can use
"saveWhenAllTagsHaveChanged". This approach may rarely persist data. - When you have several tags that work together, you can use
"saveWhenAllSpecifiedTagsHaveChanged"to delay persisting changes until all their values have changed. This approach ignores data changes in other tags. - When you are tracking several important tags and you want to capture their data when any of them changes value, you can use
"saveWhenAnySpecifiedTagHasChanged". This approach ignores data changes in other tags.
Code Example
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "modbusTCP",
"serviceName": "modbus",
"tableName": "modbusTableTCP",
"dataCollectionIntervalMilliseconds": 1000,
"dataPersistenceStrategy": "onChange",
"onChangeTrigger": "saveWhenAnySpecifiedTagHasChanged",
"onChangeTriggerTags": ["t1"],
"settings": {
"modbusProtocol": "TCP",
"modbusServer": "127.0.0.1",
"modbusServerPort": 502,
"propertyMapList": [
{
"propertyPath": "temperature",
"modbusDataAccess": "holdingregister",
"modbusDataAddress": 4003,
"modbusDataType": "int8Signed"
}
]
}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Notes
- The connector uses this property only when the
"dataPersistenceStrategy"is"onChange". -
The following properties work together to save meaningful data changes.
"dataPersistenceStrategy""maxUnsavedEvents"“normalLowerLimit”"normalUpperLimit""deadbandLowerLimit""deadbandUpperLimit""significantMagnitude""onChangeScope""onChangeScopeTags""onChangeTrigger""onChangeTriggerTags"