Hi
I have a Dropdown Node where I am Injecting 5 Options and setting 1 option as default , I am able to achieve this I need help in When I refresh the web page (F5) I want the Dropdown node to set it at the default option , as of now dropdown node shows the selected option when I refresh not the default value
Any Help would be appreciated
Thank You
You can use the ui-control node to detect a reconnect/refresh, then send the payload to set default.
Hi @E1cid
I am Currently Trying To Do that But unable to make it work so far , can you please share any example on how to do this would be really helpful
Thank You
if you provide an example flow, i would be happy to edit it to provide an example.
[
{
"id": "d272b7d18c8b067a",
"type": "tab",
"label": "FSA",
"disabled": false,
"info": "",
"env": []
},
{
"id": "0f31cab303e87f24",
"type": "group",
"z": "d272b7d18c8b067a",
"name": "DROPDOWN & LABEL",
"style": {
"stroke": "#ffC000",
"fill": "#000000",
"label": true,
"color": "#ffC000",
"label-position": "n"
},
"nodes": [
"83ebf5c5a23fd494",
"d20e4d6b75071565",
"1065de51bd6520ae",
"83d0c49d33cc479e",
"d75b35a0fe436d1a",
"6620deb48d8a257c",
"fc22666af48e79fa",
"55b49f16b3ae4147",
"01a34d049129048b",
"dfed9cfe4389664a",
"063978a01267e6e1",
"ae473f182ba20804",
"55103a635207a238",
"62825d7596c77bfa",
"665514610f12dea1",
"5c93ffdd26310340",
"531fd9e2ab3dafeb",
"92486455eb6ee230",
"e30d2df983f92f91",
"a881398ba6f071a0",
"f2119d1fc7525ab2",
"9823f2ce724d9bcc",
"83315caa933ff6ba",
"f6584adcbd01a644",
"c39b865dd3aa32c9",
"c664876c8e5784b1"
],
"x": 34,
"y": 199,
"w": 1532,
"h": 242
},
{
"id": "81e80e2b18a092f4",
"type": "group",
"z": "d272b7d18c8b067a",
"name": "CAB_SCREEN",
"style": {
"stroke": "#ff0000",
"fill": "#000000",
"label": true,
"label-position": "n",
"color": "#ffffff"
},
"nodes": [
"d987f5887ff6456f",
"2659728eb3d5605f",
"05fed5a1d3357673",
"dcf2925434069732"
],
"x": 1344,
"y": 459,
"w": 262,
"h": 162
},
{
"id": "83ebf5c5a23fd494",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LWC",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"command\":\"replace_svg\",\"svg\":\"\"}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1150,
"y": 280,
"wires": [
[
"92486455eb6ee230",
"05fed5a1d3357673"
]
]
},
{
"id": "d20e4d6b75071565",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LWC",
"tot": "str"
},
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "['LWC','LHC','LPC','LCC','LTC']",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 300,
"wires": [
[
"1065de51bd6520ae"
]
]
},
{
"id": "1065de51bd6520ae",
"type": "ui_dropdown",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"label": "",
"tooltip": "",
"place": "",
"group": "b8190790c14f3eb2",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "1",
"value": "LWC",
"type": "str"
}
],
"payload": "",
"topic": "",
"topicType": "str",
"className": "pad-this",
"x": 480,
"y": 300,
"wires": [
[
"83d0c49d33cc479e",
"063978a01267e6e1",
"9823f2ce724d9bcc"
]
]
},
{
"id": "83d0c49d33cc479e",
"type": "switch",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "LHC",
"vt": "str"
},
{
"t": "eq",
"v": "LCC",
"vt": "str"
},
{
"t": "eq",
"v": "LPC",
"vt": "str"
},
{
"t": "eq",
"v": "LWC",
"vt": "str"
},
{
"t": "eq",
"v": "LTC",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 5,
"x": 610,
"y": 300,
"wires": [
[
"6620deb48d8a257c"
],
[
"d75b35a0fe436d1a"
],
[
"fc22666af48e79fa"
],
[
"55b49f16b3ae4147"
],
[
"01a34d049129048b"
]
]
},
{
"id": "d75b35a0fe436d1a",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LCC",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "['LCC1','LCC2']",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LCC1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 240,
"wires": [
[
"665514610f12dea1"
]
]
},
{
"id": "6620deb48d8a257c",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LHC",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "\t['LHC1','LHC2','LHC3','LHC4']",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LHC1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 280,
"wires": [
[
"665514610f12dea1"
]
]
},
{
"id": "fc22666af48e79fa",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LPC",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "\t['LPC1','LPC2','LPC3','LPC4']",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LPC1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 320,
"wires": [
[
"665514610f12dea1"
]
]
},
{
"id": "55b49f16b3ae4147",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LWC",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "['LWC1']",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LWC1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 360,
"wires": [
[
"665514610f12dea1"
]
]
},
{
"id": "01a34d049129048b",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LTC",
"rules": [
{
"t": "set",
"p": "options",
"pt": "msg",
"to": "['LTC']",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "LTC",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 400,
"wires": [
[
"665514610f12dea1"
]
]
},
{
"id": "dfed9cfe4389664a",
"type": "inject",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 300,
"wires": [
[
"d20e4d6b75071565"
]
]
},
{
"id": "063978a01267e6e1",
"type": "switch",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "LCC1",
"vt": "str"
},
{
"t": "eq",
"v": "LWC1",
"vt": "str"
},
{
"t": "eq",
"v": "LHC1",
"vt": "str"
},
{
"t": "eq",
"v": "LPC1",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 1030,
"y": 320,
"wires": [
[
"ae473f182ba20804"
],
[
"83ebf5c5a23fd494"
],
[
"5c93ffdd26310340"
],
[
"531fd9e2ab3dafeb"
]
]
},
{
"id": "ae473f182ba20804",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LCC",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"command\":\"replace_svg\",\"svg\":\"\"}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1150,
"y": 240,
"wires": [
[
"e30d2df983f92f91",
"05fed5a1d3357673"
]
]
},
{
"id": "55103a635207a238",
"type": "ui_template",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"group": "8b8a3e8833737bd1",
"name": "LABEL",
"order": 1,
"width": 0,
"height": 0,
"format": "<div id=\"{{'my_'+$id}}\">Process View - Lotus Water Cabinet</div>\n<script>\n(function(scope) {\n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n $(\"#my_\"+scope.$id).html(msg.payload);\n $(\"#my_\"+scope.$id).closest(\"md-card\").css(\"background\",msg.background)\n \n }\n });\n})(scope);\n</script>",
"storeOutMessages": true,
"fwdInMessages": false,
"resendOnRefresh": true,
"templateScope": "local",
"className": "label",
"x": 1480,
"y": 400,
"wires": [
[]
]
},
{
"id": "62825d7596c77bfa",
"type": "inject",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"props": [
{
"p": "background",
"v": "#F7F8FA",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 1310,
"y": 400,
"wires": [
[
"55103a635207a238"
]
]
},
{
"id": "665514610f12dea1",
"type": "ui_dropdown",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"label": "",
"tooltip": "",
"place": "",
"group": "6dc5d74195e80de3",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "",
"topicType": "str",
"className": "pad-this",
"x": 900,
"y": 320,
"wires": [
[
"063978a01267e6e1"
]
]
},
{
"id": "5c93ffdd26310340",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LHC",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"command\":\"replace_svg\",\"svg\":\"\"}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1150,
"y": 320,
"wires": [
[
"a881398ba6f071a0",
"05fed5a1d3357673"
]
]
},
{
"id": "531fd9e2ab3dafeb",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "LPC",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1150,
"y": 360,
"wires": [
[
"f2119d1fc7525ab2",
"05fed5a1d3357673"
]
]
},
{
"id": "92486455eb6ee230",
"type": "trigger",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"op1": "Process View - Lotus Water Cabinet",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "250",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 2,
"x": 1300,
"y": 280,
"wires": [
[
"55103a635207a238"
],
[]
]
},
{
"id": "e30d2df983f92f91",
"type": "trigger",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"op1": "Process View - Lotus Cooling Cabinet",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "250",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 2,
"x": 1300,
"y": 240,
"wires": [
[
"55103a635207a238"
],
[]
]
},
{
"id": "a881398ba6f071a0",
"type": "trigger",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"op1": "Process View - Lotus Hydrogen Cabinet",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "250",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 2,
"x": 1300,
"y": 320,
"wires": [
[
"55103a635207a238"
],
[]
]
},
{
"id": "f2119d1fc7525ab2",
"type": "ui_ui_control",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"events": "all",
"x": 1280,
"y": 360,
"wires": [
[]
]
},
{
"id": "9823f2ce724d9bcc",
"type": "link out",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"mode": "link",
"links": [
"2284761699f349de",
"3fa2c48e5d259614"
],
"x": 505,
"y": 360,
"wires": []
},
{
"id": "83315caa933ff6ba",
"type": "link in",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"links": [
"8f286cd84c00d6ad"
],
"x": 275,
"y": 260,
"wires": [
[
"f6584adcbd01a644"
]
]
},
{
"id": "f6584adcbd01a644",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 340,
"wires": [
[
"1065de51bd6520ae"
]
]
},
{
"id": "c39b865dd3aa32c9",
"type": "change",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 380,
"wires": [
[
"1065de51bd6520ae"
]
]
},
{
"id": "c664876c8e5784b1",
"type": "link in",
"z": "d272b7d18c8b067a",
"g": "0f31cab303e87f24",
"name": "",
"links": [
"b4ccf8ede0ced23a",
"fd6ea2634d62f4b3"
],
"x": 185,
"y": 380,
"wires": [
[
"c39b865dd3aa32c9"
]
]
},
{
"id": "d987f5887ff6456f",
"type": "link in",
"z": "d272b7d18c8b067a",
"g": "81e80e2b18a092f4",
"name": "",
"links": [
"fdadf35183d41e77",
"38f25f85f6719168",
"6e96c561085058f8"
],
"x": 1385,
"y": 500,
"wires": [
[
"05fed5a1d3357673"
]
]
},
{
"id": "2659728eb3d5605f",
"type": "link in",
"z": "d272b7d18c8b067a",
"g": "81e80e2b18a092f4",
"name": "",
"links": [
"618a40a6e2902e7b",
"799745fdf2bb754d"
],
"x": 1385,
"y": 540,
"wires": [
[
"05fed5a1d3357673"
]
]
},
{
"id": "05fed5a1d3357673",
"type": "ui_svg_graphics",
"z": "d272b7d18c8b067a",
"g": "81e80e2b18a092f4",
"group": "26daf97563f13ff7",
"order": 2,
"width": 0,
"height": 0,
"svgString": "",
"clickableShapes": [],
"javascriptHandlers": [],
"smilAnimations": [],
"bindings": [],
"showCoordinates": false,
"autoFormatAfterEdit": false,
"showBrowserErrors": false,
"showBrowserEvents": false,
"enableJsDebugging": false,
"sendMsgWhenLoaded": false,
"noClickWhenDblClick": false,
"outputField": "payload",
"editorUrl": "//drawsvg.org/drawsvg.html",
"directory": "",
"panning": "disabled",
"zooming": "disabled",
"panOnlyWhenZoomed": false,
"doubleClickZoomEnabled": false,
"mouseWheelZoomEnabled": false,
"dblClickZoomPercentage": 150,
"cssString": "div.ui-svg svg{\n color: var(--nr-dashboard-widgetColor);\n fill: currentColor !important;\n}\ndiv.ui-svg path {\n fill: inherit;\n}",
"name": "",
"x": 1500,
"y": 540,
"wires": [
[]
]
},
{
"id": "dcf2925434069732",
"type": "link in",
"z": "d272b7d18c8b067a",
"g": "81e80e2b18a092f4",
"name": "",
"links": [
"5657f8dbaeda070a",
"7e826ebf3a2891c9"
],
"x": 1385,
"y": 580,
"wires": [
[
"05fed5a1d3357673"
]
]
},
{
"id": "c702d4881436dc1e",
"type": "function",
"z": "d272b7d18c8b067a",
"name": "Read Value",
"func": "var output=[];\nvar values=msg.payload;\nfor (var v in values){\n output.push({payload:values[v]});\n}\nreturn output[1];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1010,
"y": 600,
"wires": [
[]
]
},
{
"id": "a788c7c8f5568b53",
"type": "function",
"z": "d272b7d18c8b067a",
"name": "FAN502",
"func": "a=msg.payload;\nv=0\nwhile(v<=10000){\n if(a[v].name==\"1/LHC1/FAN502\"){\n msg.payload=a[v].value;\n break\n }\n v++\n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1160,
"y": 600,
"wires": [
[]
]
},
{
"id": "b8190790c14f3eb2",
"type": "ui_group",
"name": "Cabinet Type",
"tab": "c980752b40eba0b1",
"order": 9,
"disp": true,
"width": "3",
"collapse": false,
"className": ""
},
{
"id": "8b8a3e8833737bd1",
"type": "ui_group",
"name": "Label",
"tab": "c980752b40eba0b1",
"order": 10,
"disp": false,
"width": 23,
"collapse": false,
"className": ""
},
{
"id": "6dc5d74195e80de3",
"type": "ui_group",
"name": "Cabinet",
"tab": "c980752b40eba0b1",
"order": 8,
"disp": true,
"width": 3,
"collapse": false,
"className": ""
},
{
"id": "26daf97563f13ff7",
"type": "ui_group",
"name": "Process view ",
"tab": "c980752b40eba0b1",
"order": 1,
"disp": true,
"width": 24,
"collapse": false,
"className": ""
},
{
"id": "c980752b40eba0b1",
"type": "ui_tab",
"name": "Field Support Application ",
"icon": "dashboard",
"order": 21,
"disabled": false,
"hidden": false
}
]
I meant a simple example I could add to to show you how. You need to think how can i give info in a concise way, then more people would jump into help.
here is one way to reload options on page refresh.
I noticed you are using J: to enter objects, that is overkill as you do not need the JSONata package. You can use json {} but you have to use double quotes as single are not json valid.
here is example
[{"id":"77c5e7fc.a603e","type":"ui_ui_control","z":"bf9e1e33.030598","name":"","events":"connect","x":710,"y":2560,"wires":[["615c89c7.a9f1c","ec534590.c1c83"]]},{"id":"615c89c7.a9f1c","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1130,"y":2620,"wires":[]},{"id":"ec534590.c1c83","type":"switch","z":"bf9e1e33.030598","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"connect","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":880,"y":2560,"wires":[["fd1a4def.d2339"]]},{"id":"fd1a4def.d2339","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[\"LWC\",\"LHC\",\"LPC\",\"LCC\",\"LTC\"]","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"LWC","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":2640,"wires":[["abf50011.202a4","615c89c7.a9f1c"]]},{"id":"e998ac03.0c25c","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"options","v":"[\"LWC\",\"LHC\",\"LPC\",\"LCC\",\"LTC\"]","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"LWC","payloadType":"str","x":550,"y":2640,"wires":[["fd1a4def.d2339"]]},{"id":"abf50011.202a4","type":"ui_dropdown","z":"bf9e1e33.030598","name":"","label":"","tooltip":"","place":"","group":"b8190790c14f3eb2","order":1,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"1","value":"LWC","type":"str"}],"payload":"","topic":"","topicType":"str","className":"pad-this","x":930,"y":2640,"wires":[[]]},{"id":"b8190790c14f3eb2","type":"ui_group","name":"Cabinet Type","tab":"c980752b40eba0b1","order":9,"disp":true,"width":"3","collapse":false,"className":""},{"id":"c980752b40eba0b1","type":"ui_tab","name":"Field Support Application ","icon":"dashboard","order":21,"disabled":false,"hidden":false}]
Hi @E1cid
Thanks for the example It solved my issue . I will keep that in mind for next time I ask a question
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.