AF Attribute Template
AF-Attribute-Template-Update
Input
| Inputs | Type | Mandatory | Description |
|---|---|---|---|
| CheckinLimit | int | N | |
| AttributeTemplates | JSAttributeItems array | Y | |
| TargetPrimaryPath | string | Y | |
| CreateSubAttributes | bool | N | |
| SourceAttribute | Y | ||
| AttributeProperties | array | Y | |
| Name | string | Y | |
| Description | string | Y | |
| Categories | array of string | Y | |
| ConfigString | string | Y | |
| DataReferencePlugIn | string | Y | |
| DefaultUOM | string | Y | |
| IsConfigurationItem | string | Y | |
| IsManualDataEntry | string | Y | |
| IsHidden | string | Y | |
| IsExcluded | string | Y | |
| Value | JSAttributeVal | Y | |
| IsAnythingValue | Y | ||
| TypeQualifier | string | Y | |
| IsTypeQualifierGlobal | bool | Y | Global Enums such as System |
| Categories | string[] | Y | |
| Attributes | Y | Can continuously dig down due to child attributes | |
| AttributeProperties | array | Y | |
| Attributes | array | Y |
payload
Output
| Outputs | Type | Description | Example |
|---|---|---|---|
| array[1] | |||
| 0 | object | ||
| Properties | object | ||
| PrimaryPath | ""\NodeADSTestSystem\NodeTestCaseTarget\ElementTemplates[Pump]"" | ||
| Action | ""Synced"" |
Payload Example
Replace PISystem and Database w/ strings
msg.payload =
{"AttributeTemplates": [
{
"TargetPrimaryPath": "\\\\"+ env.get("TestSystem")+"\\" + env.get("TestDatabase") +"\\ElementTemplates[Pump]",
"SourceAttribute": {
"AttributeProperties": {
"Name": "Sensor",
"IsATemplate": true,
"Description": "hello world",
"ValueType": "Double",
"ConfigString": "",
"SimpleConfig": "",
"DataReferencePlugIn": "",
"DefaultUOM": "",
"DefaultValue": 0,
"DisplayDigits": -5,
"IsConfigurationItem": "False",
"IsManualDataEntry": "False",
"IsExcluded": "False",
"IsHidden": "False",
"TypeQualifier": "",
"IsTypeQualifierGlobal": false,
"Categories": [],
"Value": {
"IsAnythingValue": false,
"T": "Double",
"V": 0
}
},
"Attributes": null
},
"TargetAttribute": null
}
]
};
return msg;
## Full test sub flow
[
{
""id"": ""55ba87b.2e5f678"",
""type"": ""subflow"",
""name"": ""TestADSNode_Sync-Attribute-Template"",
""info"": ""## Description\nThis test includes refreshing the servers, databases and checking in.\n\n## Version\n1.0.0\n\n## Prerequsites\nElementTemplate \""Pump\"" must exist & AttributeTemplate \""Sensor\"" must exist\n\n## Inputs\nTestServer\nTestDatabase\n\n## Expected Outcome\nAttributeTemplate \""Sensor\"" is synchronised with desciption \""hello world\"" in ElementTemplate \""Pump\"""",
""category"": """",
""in"": [
{
""x"": 40,
""y"": 80,
""wires"": [
{
""id"": ""afed7b8d.7fe0d8""
}
]
}
],
""out"": [
{
""x"": 1540,
""y"": 160,
""wires"": [
{
""id"": ""c3f33433.a07bc8"",
""port"": 0
}
]
}
],
""env"": [
{
""name"": ""TestSystem"",
""type"": ""str"",
""value"": ""Dev-AF1""
},
{
""name"": ""TestDatabase"",
""type"": ""str"",
""value"": ""NodeTestCaseSource""
}
],
""meta"": {},
""color"": ""#DDAA99""
},
{
""id"": ""c3f33433.a07bc8"",
""type"": ""AFCheckIn"",
""z"": ""55ba87b.2e5f678"",
""name"": """",
""x"": 1390,
""y"": 160,
""wires"": [
[]
]
},
{
""id"": ""835d451f.566f28"",
""type"": ""function"",
""z"": ""55ba87b.2e5f678"",
""name"": ""CheckIn Config"",
""func"": ""msg.payload = {};\nmsg.payload.PISystem = env.get(\""TestSystem\"");\nmsg.payload.Database = env.get(\""TestDatabase\"");\nmsg.payload.CheckInMode = \""ToMe\"";\nreturn msg;"",
""outputs"": 1,
""noerr"": 0,
""initialize"": """",
""finalize"": """",
""x"": 1220,
""y"": 160,
""wires"": [
[
""c3f33433.a07bc8""
]
]
},
{
""id"": ""2bb23ed7.0d2cd2"",
""type"": ""debug"",
""z"": ""55ba87b.2e5f678"",
""name"": ""sync-attribute-template"",
""active"": true,
""tosidebar"": true,
""console"": false,
""tostatus"": false,
""complete"": ""true"",
""targetType"": ""full"",
""statusVal"": """",
""statusType"": ""auto"",
""x"": 960,
""y"": 220,
""wires"": []
},
{
""id"": ""f6b60cbc.bb9"",
""type"": ""function"",
""z"": ""55ba87b.2e5f678"",
""name"": ""RefreshTargetDatabases"",
""func"": ""var server = env.get(\""TestSystem\"");\nmsg.payload = {\n \""ItemType\"":\""AFDatabases\"",\n \""Input\"":server\n}\nreturn msg;"",
""outputs"": 1,
""noerr"": 0,
""initialize"": """",
""finalize"": """",
""x"": 470,
""y"": 120,
""wires"": [
[
""9fcca485.f223f8""
]
]
},
{
""id"": ""9fcca485.f223f8"",
""type"": ""afserver-information"",
""z"": ""55ba87b.2e5f678"",
""name"": """",
""x"": 540,
""y"": 160,
""wires"": [
[
""e645e44.665a218""
]
]
},
{
""id"": ""afed7b8d.7fe0d8"",
""type"": ""function"",
""z"": ""55ba87b.2e5f678"",
""name"": ""Get and refresh servers"",
""func"": ""msg.payload = {\""ItemType\"":\""AFServers\"",\""Input\"":\""\""};\nreturn msg;"",
""outputs"": 1,
""noerr"": 0,
""initialize"": """",
""finalize"": """",
""x"": 190,
""y"": 80,
""wires"": [
[
""daebbbd5.ba0e08""
]
]
},
{
""id"": ""daebbbd5.ba0e08"",
""type"": ""afserver-information"",
""z"": ""55ba87b.2e5f678"",
""name"": """",
""x"": 240,
""y"": 120,
""wires"": [
[
""f6b60cbc.bb9""
]
]
},
{
""id"": ""e645e44.665a218"",
""type"": ""function"",
""z"": ""55ba87b.2e5f678"",
""name"": ""Payload"",
""func"": ""msg.payload = \n{\""AttributeTemplates\"": [\n {\n \""TargetPrimaryPath\"": \""\\\\\\\\\""+ env.get(\""TestSystem\"")+\""\\\\\"" + env.get(\""TestDatabase\"") +\""\\\\ElementTemplates[Pump]\"",\n \""SourceAttribute\"": {\n \""AttributeProperties\"": {\n \""Name\"": \""Sensor\"",\n \""IsATemplate\"": true,\n \""Description\"": \""hello world\"",\n \""ValueType\"": \""Double\"",\n \""ConfigString\"": \""\"",\n \""SimpleConfig\"": \""\"",\n \""DataReferencePlugIn\"": \""\"",\n \""DefaultUOM\"": \""\"",\n \""DefaultValue\"": 0,\n \""DisplayDigits\"": -5,\n \""IsConfigurationItem\"": \""False\"",\n \""IsManualDataEntry\"": \""False\"",\n \""IsExcluded\"": \""False\"",\n \""IsHidden\"": \""False\"",\n \""TypeQualifier\"": \""\"",\n \""IsTypeQualifierGlobal\"": false,\n \""Categories\"": [],\n \""Value\"": {\n \""IsAnythingValue\"": false,\n \""T\"": \""Double\"",\n \""V\"": 0\n }\n },\n \""Attributes\"": null\n },\n \""TargetAttribute\"": null\n }\n ]\n};\nreturn msg;"",
""outputs"": 1,
""noerr"": 0,
""initialize"": """",
""finalize"": """",
""libs"": [],
""x"": 780,
""y"": 160,
""wires"": [
[
""df254d34.24da6""
]
]
},
{
""id"": ""df254d34.24da6"",
""type"": ""sync-attribute-template"",
""z"": ""55ba87b.2e5f678"",
""name"": """",
""x"": 960,
""y"": 160,
""wires"": [
[
""835d451f.566f28"",
""2bb23ed7.0d2cd2""
]
]
},
{
""id"": ""c878080.e784bf8"",
""type"": ""subflow:55ba87b.2e5f678"",
""z"": ""d136f05b9373282b"",
""name"": """",
""env"": [],
""x"": 380,
""y"": 420,
""wires"": [
[
""5cf3d5e7fea3f94d""
]
]
}
]