Hello everyone, i want to create a flow where a form is filled out with employee names, shifts (selected from a dropdown), and some individual inputs. These should then be sent/saved to a database when the submit button is pressed and subsequently displayed in a table on the dashboard. I'm having a bit of trouble logically connecting the various nodes so that all data is forwarded to the database. Can someone please help me with this? Unfortunately, I have no prior experience with Node-RED and databases.
Here is what i got so far:
[
{
"id": "5b0a3e478fc4927b",
"type": "ui-dropdown",
"z": "e23b1ec257b976f3",
"group": "0dab66fce8695736",
"name": "employee",
"label": "Mitarbeiter",
"tooltip": "",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "",
"value": "Abdullah Terzi",
"type": "str"
},
{
"label": "",
"value": "Alexander Baumtrok",
"type": "str"
},
{
"label": "",
"value": "Alexander Brozmann",
"type": "str"
},
{
"label": "",
"value": "Ali Celik",
"type": "str"
},
{
"label": "",
"value": "Andreas Lorenz",
"type": "str"
},
{
"label": "",
"value": "Arman Vakili",
"type": "str"
},
{
"label": "",
"value": "Baturay Sener",
"type": "str"
},
{
"label": "",
"value": "Chi-Khang Nguyen",
"type": "str"
},
{
"label": "",
"value": "Daniel Wiss",
"type": "str"
},
{
"label": "",
"value": "Dimitri Hermann",
"type": "str"
},
{
"label": "",
"value": "Dominik Krklec",
"type": "str"
},
{
"label": "",
"value": "Eduard Ditz",
"type": "str"
},
{
"label": "",
"value": "Ernst Fil",
"type": "str"
},
{
"label": "",
"value": "Florian Heiler",
"type": "str"
},
{
"label": "",
"value": "Haris Keskinovic",
"type": "str"
},
{
"label": "",
"value": "Harrie Jung",
"type": "str"
},
{
"label": "",
"value": "Igor Kappes",
"type": "str"
},
{
"label": "",
"value": "Jewgeni Kultenko",
"type": "str"
},
{
"label": "",
"value": "Johannes Kammerzell",
"type": "str"
},
{
"label": "",
"value": "Klaus Bächle",
"type": "str"
},
{
"label": "",
"value": "Matthias Mompas",
"type": "str"
},
{
"label": "",
"value": "Metin Tosun",
"type": "str"
},
{
"label": "",
"value": "Mehmet Incili",
"type": "str"
},
{
"label": "",
"value": "Michael Sanders",
"type": "str"
},
{
"label": "",
"value": "Michael Woschek",
"type": "str"
},
{
"label": "",
"value": "Negjdet Berisha",
"type": "str"
},
{
"label": "",
"value": "Nicolai Fedotow",
"type": "str"
},
{
"label": "",
"value": "Pavol Bucko",
"type": "str"
},
{
"label": "",
"value": "Samuel Laval",
"type": "str"
},
{
"label": "",
"value": "Stefan Leonte",
"type": "str"
},
{
"label": "",
"value": "Sven Neunzig",
"type": "str"
},
{
"label": "",
"value": "Thomas Bauer",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 240,
"y": 840,
"wires": [
[
"1e15d042bdcffce9"
]
]
},
{
"id": "6b31c0b734262b23",
"type": "ui-dropdown",
"z": "e23b1ec257b976f3",
"group": "0dab66fce8695736",
"name": "machine",
"label": "Maschine:",
"tooltip": "",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "",
"value": "FEN21",
"type": "str"
},
{
"label": "",
"value": "FEN22",
"type": "str"
},
{
"label": "",
"value": "FEN23",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 240,
"y": 920,
"wires": [
[
"16035ce91cc410e8"
]
]
},
{
"id": "b3de3de7dce8262f",
"type": "ui-dropdown",
"z": "e23b1ec257b976f3",
"group": "0dab66fce8695736",
"name": "shift",
"label": "Schicht:",
"tooltip": "",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "",
"value": "FrĂĽhschicht",
"type": "str"
},
{
"label": "",
"value": "Spätschicht",
"type": "str"
},
{
"label": "",
"value": "Nachtschicht",
"type": "str"
},
{
"label": "",
"value": "Tagschicht",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 230,
"y": 1000,
"wires": [
[
"57be5b16b1cae855"
]
]
},
{
"id": "5b283cf0a88562d6",
"type": "ui-form",
"z": "e23b1ec257b976f3",
"name": "fendaten",
"group": "0dab66fce8695736",
"label": "",
"order": 4,
"width": 0,
"height": 0,
"options": [
{
"label": "FA",
"key": "fa_number",
"type": "text",
"required": true,
"rows": null
},
{
"label": "Charge-Rohwickel",
"key": "cal_chargenr",
"type": "text",
"required": false,
"rows": null
},
{
"label": "Charge-Fertigwickel",
"key": "notch_chargenr",
"type": "text",
"required": false,
"rows": null
},
{
"label": "Gut",
"key": "ok_amount",
"type": "number",
"required": false,
"rows": null
},
{
"label": "Ausschuss",
"key": "nok_amount",
"type": "number",
"required": false,
"rows": null
},
{
"label": "Gebucht",
"key": "booked",
"type": "checkbox",
"required": false,
"rows": null
}
],
"formValue": {
"fa_number": "",
"cal_chargenr": "",
"notch_chargenr": "",
"ok_amount": "",
"nok_amount": "",
"booked": false
},
"payload": "",
"submit": "Absenden",
"cancel": "Abbrechen",
"resetOnSubmit": true,
"topic": "topic",
"topicType": "msg",
"splitLayout": "",
"className": "",
"x": 240,
"y": 1060,
"wires": [
[
"ab1e692ada68cf32"
]
]
},
{
"id": "fcd507ca04f15f94",
"type": "ui-table",
"z": "e23b1ec257b976f3",
"group": "eb5e8d5cc746c36b",
"name": "datenanzeige",
"order": 2,
"width": 0,
"height": 0,
"maxrows": "",
"autocols": true,
"showSearch": false,
"selectionType": "none",
"columns": [],
"x": 1170,
"y": 1100,
"wires": [
[]
]
},
{
"id": "1e15d042bdcffce9",
"type": "change",
"z": "e23b1ec257b976f3",
"name": "",
"rules": [
{
"t": "set",
"p": "mitarbeiter",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 840,
"wires": [
[]
]
},
{
"id": "16035ce91cc410e8",
"type": "change",
"z": "e23b1ec257b976f3",
"name": "",
"rules": [
{
"t": "set",
"p": "fen",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 920,
"wires": [
[]
]
},
{
"id": "57be5b16b1cae855",
"type": "change",
"z": "e23b1ec257b976f3",
"name": "",
"rules": [
{
"t": "set",
"p": "schicht",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 1000,
"wires": [
[]
]
},
{
"id": "ab1e692ada68cf32",
"type": "change",
"z": "e23b1ec257b976f3",
"name": "",
"rules": [
{
"t": "set",
"p": "fendaten",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 590,
"y": 1060,
"wires": [
[
"ae6a44ac6e2a0d98"
]
]
},
{
"id": "ae6a44ac6e2a0d98",
"type": "function",
"z": "e23b1ec257b976f3",
"name": "Combine Data",
"func": "var mitarbeiter = flow.get('mitarbeiter') || '';\nvar fen = flow.get('fen') || '';\nvar schicht = flow.get('schicht') || '';\nvar fendaten = flow.get('fendaten') || {};\n\nvar combinedData = {\n mitarbeiter: mitarbeiter,\n fen: fen,\n schicht: schicht,\n fa: fendaten.fa,\n 'Charge-Rohwickel': fendaten['Charge-Rohwickel'],\n 'Charge-Fertigwickel': fendaten['Charge-Fertigwickel'],\n Gut: fendaten.Gut,\n Ausschuss: fendaten.Ausschuss,\n Gebucht: fendaten.Gebucht\n};\n\nmsg.payload = [combinedData]; // set payload to an array of objects\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 860,
"y": 1060,
"wires": [
[
"fcd507ca04f15f94",
"c51b0dcfac9b5408"
]
]
},
{
"id": "c51b0dcfac9b5408",
"type": "sqlite",
"z": "e23b1ec257b976f3",
"mydb": "DATABASE_CONFIG",
"sqlquery": "msg.topic",
"sql": "",
"name": "",
"x": 910,
"y": 1140,
"wires": [
[
"fcd507ca04f15f94"
]
]
},
{
"id": "0dab66fce8695736",
"type": "ui-group",
"name": "fen20",
"page": "e6d4daf71da027b7",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "eb5e8d5cc746c36b",
"type": "ui-group",
"name": "fendaten",
"page": "e6d4daf71da027b7",
"width": "6",
"height": "1",
"order": 2,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "DATABASE_CONFIG",
"type": "sqlitedb",
"db": "test.db"
},
{
"id": "e6d4daf71da027b7",
"type": "ui-page",
"name": "fen20",
"ui": "8ced774a3726a8f8",
"path": "/fentest",
"icon": "home",
"layout": "grid",
"theme": "49f869ea61eecbd4",
"order": 4,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "8ced774a3726a8f8",
"type": "ui-base",
"name": "UI Name",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control"
],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "49f869ea61eecbd4",
"type": "ui-theme",
"name": "lc",
"colors": {
"surface": "#ffffff",
"primary": "#00d10e",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
}
]