Join output from FORM and function

Hello,

I try to use a join node to merge the output from a form with a output from a function to generate one json file. Unfortunly without sucsess.

Here is what i have so far:

[
    {
        "id": "8d9352e68a70b1fd",
        "type": "ui_form",
        "z": "82ac19b71eb25b31",
        "name": "Form_Monitoring_email",
        "label": "",
        "group": "bab7662c278a9478",
        "order": 1,
        "width": 5,
        "height": 1,
        "options": [
            {
                "label": "HEADER",
                "value": "header_mon",
                "type": "text",
                "required": false,
                "rows": null
            },
            {
                "label": "Recipient I",
                "value": "recipient_i_mon",
                "type": "email",
                "required": false,
                "rows": null
            },
            {
                "label": "Recipient ĂŤI",
                "value": "recipient_ii_mon",
                "type": "text",
                "required": false,
                "rows": null
            },
            {
                "label": "Recipient III",
                "value": "recipient_iii_mon",
                "type": "text",
                "required": false,
                "rows": null
            },
            {
                "label": "Recipient IV",
                "value": "recipient_iv_mon",
                "type": "text",
                "required": false,
                "rows": null
            },
            {
                "label": "TIME",
                "value": "time_mon",
                "type": "time",
                "required": false,
                "rows": null
            },
            {
                "label": "ON/OFF",
                "value": "onoff_mon",
                "type": "switch",
                "required": false,
                "rows": null
            }
        ],
        "formValue": {
            "header_mon": "",
            "recipient_i_mon": "",
            "recipient_ii_mon": "",
            "recipient_iii_mon": "",
            "recipient_iv_mon": "",
            "time_mon": "",
            "onoff_mon": false
        },
        "payload": "",
        "submit": "submit",
        "cancel": "",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 230,
        "y": 980,
        "wires": [
            [
                "5764cc98b83d07a8",
                "ef0cb261063f0e03",
                "68a215f7e32ede19",
                "481883beddbfb833",
                "3ee58843037493fc",
                "ab9d78458ee8f0c1",
                "d53af7de0858a5d1",
                "de3608747211ba15",
                "115c60abe275ac18"
            ]
        ]
    },
    {
        "id": "5764cc98b83d07a8",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_header",
        "func": "msg.payload = msg.payload.header_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 900,
        "wires": [
            [
                "638eb62d60cb1f83"
            ]
        ]
    },
    {
        "id": "ef0cb261063f0e03",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_rec1",
        "func": "msg.payload = msg.payload.recipient_i_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 940,
        "wires": [
            [
                "d13514091db804d1"
            ]
        ]
    },
    {
        "id": "68a215f7e32ede19",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_rec2",
        "func": "msg.payload = msg.payload.recipient_ii_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 980,
        "wires": [
            [
                "7764e1e0525aead9"
            ]
        ]
    },
    {
        "id": "481883beddbfb833",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_rec3",
        "func": "msg.payload = msg.payload.recipient_iii_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 1020,
        "wires": [
            [
                "82960e75e298387e"
            ]
        ]
    },
    {
        "id": "3ee58843037493fc",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_rec4",
        "func": "msg.payload = msg.payload.recipient_iv_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 1060,
        "wires": [
            [
                "9bf39b9929f32aeb"
            ]
        ]
    },
    {
        "id": "ab9d78458ee8f0c1",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_time",
        "func": "msg.payload = msg.payload.time_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 1100,
        "wires": [
            [
                "bb50f400ae29fc88"
            ]
        ]
    },
    {
        "id": "d53af7de0858a5d1",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "temp_mon_onoff",
        "func": "msg.payload = msg.payload.onoff_mon\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 1140,
        "wires": [
            [
                "b59778d570969767"
            ]
        ]
    },
    {
        "id": "bb50f400ae29fc88",
        "type": "function",
        "z": "82ac19b71eb25b31",
        "name": "get hours and minutes",
        "func": "const time = new Date(msg.payload)\n// this is the number of milliseconds into the day, if needed\n//const msecLocal = time.getTime() - time.getTimezoneOffset() * 60000\nconst hours = time.getHours()\nconst mins = time.getMinutes()\nmsg.payload = `${hours.toString().padStart(2, \"0\")}:${mins.toString().padStart(2, \"0\")}`\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 1100,
        "wires": [
            [
                "a7b6fc5b27f43c27",
                "115c60abe275ac18"
            ]
        ]
    },
    {
        "id": "115c60abe275ac18",
        "type": "join",
        "z": "82ac19b71eb25b31",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "7",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 670,
        "y": 800,
        "wires": [
            [
                "e1c41221f400be93"
            ]
        ]
    },
    {
        "id": "de3608747211ba15",
        "type": "debug",
        "z": "82ac19b71eb25b31",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 400,
        "y": 800,
        "wires": []
    },
    {
        "id": "bab7662c278a9478",
        "type": "ui_group",
        "name": "Monitoring email",
        "tab": "d95144c56e383182",
        "order": 6,
        "disp": true,
        "width": 5,
        "collapse": false,
        "className": ""
    },
    {
        "id": "d95144c56e383182",
        "type": "ui_tab",
        "name": "Jung Von Matt",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

Thank you

Why not just alter/add the object properties you wish, rather than try to join/merge.
All you require then is one change or function node.
e.g.

[{"id":"8d9352e68a70b1fd","type":"ui_form","z":"b9860b4b9de8c8da","name":"Form_Monitoring_email","label":"","group":"bab7662c278a9478","order":1,"width":5,"height":1,"options":[{"label":"HEADER","value":"header_mon","type":"text","required":false,"rows":null},{"label":"Recipient I","value":"recipient_i_mon","type":"email","required":false,"rows":null},{"label":"Recipient ĂŤI","value":"recipient_ii_mon","type":"text","required":false,"rows":null},{"label":"Recipient III","value":"recipient_iii_mon","type":"text","required":false,"rows":null},{"label":"Recipient IV","value":"recipient_iv_mon","type":"text","required":false,"rows":null},{"label":"TIME","value":"time_mon","type":"time","required":false,"rows":null},{"label":"ON/OFF","value":"onoff_mon","type":"switch","required":false,"rows":null}],"formValue":{"header_mon":"","recipient_i_mon":"","recipient_ii_mon":"","recipient_iii_mon":"","recipient_iv_mon":"","time_mon":"","onoff_mon":false},"payload":"","submit":"submit","cancel":"","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":210,"y":2400,"wires":[["8d9352e68a70b1fd","58b4e68f5cce095a","68cde66f7d9ddc5d"]]},{"id":"58b4e68f5cce095a","type":"change","z":"b9860b4b9de8c8da","name":"","rules":[{"t":"set","p":"payload.time_mon","pt":"msg","to":"$moment($$.payload.time_mon).format(\"HH:mm\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":2400,"wires":[["de3608747211ba15"]]},{"id":"68cde66f7d9ddc5d","type":"function","z":"b9860b4b9de8c8da","name":"get hours and minutes","func":"const time = new Date(msg.payload.time_mon)\n// this is the number of milliseconds into the day, if needed\n//const msecLocal = time.getTime() - time.getTimezoneOffset() * 60000\nconst hours = time.getHours()\nconst mins = time.getMinutes()\nmsg.payload.time_mon = `${hours.toString().padStart(2, \"0\")}:${mins.toString().padStart(2, \"0\")}`\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":2480,"wires":[["57e9db6e5c0fb572"]]},{"id":"de3608747211ba15","type":"debug","z":"b9860b4b9de8c8da","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":2420,"wires":[]},{"id":"57e9db6e5c0fb572","type":"debug","z":"b9860b4b9de8c8da","name":"debug 324","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":2480,"wires":[]},{"id":"bab7662c278a9478","type":"ui_group","name":"Monitoring email","tab":"d95144c56e383182","order":6,"disp":true,"width":5,"collapse":false,"className":""},{"id":"d95144c56e383182","type":"ui_tab","name":"Jung Von Matt","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

1 Like

was the easierst solution. thank you

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.