Pass data throught a button to SQL Table

Hello!
I have created a UI like this:
</>

When I press the button 'CARICA' I would insert the inserted data to an SQL table (already created).
Which flow can I use? How can I pass inserted data to the SQL table (I have the flow for the connection to the SQL database.

Many thanks

How is this different from your prior thread RequestError: Incorrect syntax near '.'

Here is a solution (one of many on the forum)

It uses a form so that all dashboard inputs arrive at the SQL node at the same time.

If you are using separate UI elements, then you will need to either use a JOIN node (to make a single object with all the user values in) OR use flow/global context to store the users input.

Thank you Steve, this can help me!
I installed the suggest node of MSSQL plus, but I don't see the same format (I continue to see the format for the SQL standard node)

</>

Another question: for the Form node, do you know if it is possible to include dropdown menu for some field?

You need to remove the 5y old MSSQL node & restart node-red

No, the UI form doesnt have a drop down.

In your case you probably need to use individual components & store the values in rediness for when the button is pressed. Did you see the following post?

If you dont want to use the ui_form then you need to store the individual values entered and recover them when the done button is pressed e.g....

yes, I see but but I don't see the information inside the node Store and Get.
Do you have suggestion also for JOIN node?

They are just change nodes. Very basic. I think maybe you are new to node-red? I'll post a couple of canned replies below that will help...


See this article in the cookbook for an example of how to join messages into one object.


I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

is it correct to use for uninstall the old
</>
npm uninstall -g node-red-contrib-mssql

and than install this new

</>
npm install node-red-contrib-mssql-plus`

Depends where you installed it in the first place.

Typically, it is installed in your node-red folder (not global)

CD into your .node-red folder then run npm uninstall node-red-contrib-mssql

In this case, what I have to send to the button ?
</>

I have three separate variables (as in the flow reported in the example)

Depends how you saved them in context.

can you share a minimal flow (the parts of interest only)?

I cant look inside the nodes if you only share a picture.

Select the nodes of interest, press CTRL+E and copy the flow.

Paste copied flow in a reply (use the </> code button)

firstly, you have only posted 1 node - I need you to select all nodes you showed in that screenshot.
secondly, you did not paste the flow in the right place & it is corrupted by forum formatting.

```
PASTE FLOW CODE INSIDE BACKTICKS
```

[{"id":"bce72d0f261b67cb","type":"ui_button","z":"e0129591b64c21bc","name":"","group":"2733e4a59af46689","order":4,"width":0,"height":0,"passthru":false,"label":"Carica","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":380,"wires":[["bf23e13acd4755f5"]]},{"id":"bf23e13acd4755f5","type":"change","z":"e0129591b64c21bc","name":"","rules":[{"t":"set","p":"payload1","pt":"msg","to":"UserInputTip","tot":"flow"},{"t":"set","p":"payload2","pt":"msg","to":"TextInput","tot":"flow"},{"t":"set","p":"payload3","pt":"msg","to":"UserInputCl","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":380,"wires":[["25e5761ffbe89611","1db479193c8afbc3"]]},{"id":"46b4474ec3fa7473","type":"ui_dropdown","z":"e0129591b64c21bc","name":"TIPOLOGIA","label":"TIPOLOGIA","tooltip":"","place":"Select option","group":"2733e4a59af46689","order":1,"width":"9","height":"1","passthru":true,"multiple":false,"options":[{"label":"Attrezzatura","value":"Attrezzatura","type":"str"},{"label":"Strumentazione","value":"Strumentazione","type":"str"}],"payload":"","topic":"payload","topicType":"msg","className":"","x":110,"y":160,"wires":[["59ca0d5e6c329d86"]]},{"id":"a6b5e5dadea9aa3b","type":"change","z":"e0129591b64c21bc","name":"","rules":[{"t":"set","p":"TextInput","pt":"flow","to":"payload2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":220,"wires":[["ad9197c903577eba"]]},{"id":"fcfa9bd412d25121","type":"ui_text_input","z":"e0129591b64c21bc","name":"","label":"","tooltip":"","group":"2733e4a59af46689","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"TextInput","sendOnBlur":true,"className":"","topicType":"flow","x":100,"y":220,"wires":[["a6b5e5dadea9aa3b"]]},{"id":"bffd5199f28bef9f","type":"ui_dropdown","z":"e0129591b64c21bc","name":"CLASSIFICAZIONE","label":"CLASSIFICAZIONE","tooltip":"","place":"Select option","group":"2733e4a59af46689","order":3,"width":"9","height":"1","passthru":true,"multiple":false,"options":[{"label":"Primario","value":"Primario","type":"str"},{"label":"Secondario","value":"Secondario","type":"str"}],"payload":"","topic":"payload","topicType":"msg","className":"","x":140,"y":280,"wires":[["ad8dfbbda055fbc4"]]},{"id":"ad8dfbbda055fbc4","type":"change","z":"e0129591b64c21bc","name":"","rules":[{"t":"set","p":"UserInputCl","pt":"flow","to":"payload3","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":280,"wires":[["7e9ce1925c496ba7"]]},{"id":"2733e4a59af46689","type":"ui_group","name":"Inserimento Nuovo Strumento","tab":"fa803f07a50afa29","order":1,"disp":true,"width":"9","collapse":false,"className":""},{"id":"fa803f07a50afa29","type":"ui_tab","name":"Inserimento Attrezzature-Strumentazione","icon":"dns","order":2,"disabled":false,"hidden":false}]

I included the nodes of the three inputs and of the Button

Here is a working flow. Look at the settings I used and how it flows.

image

image

Demo flow (use CTRL+I to import)

[
    {
        "id": "89f0d8bb4916ea84",
        "type": "ui_toast",
        "z": "7c13b8452619581b",
        "position": "top right",
        "displayTime": "3",
        "highlight": "red",
        "sendall": true,
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Error",
        "name": "",
        "x": 1120,
        "y": 480,
        "wires": []
    },
    {
        "id": "ca1b95d22899ed5f",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Classification is empty",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 912,
        "y": 480,
        "wires": [
            [
                "89f0d8bb4916ea84"
            ]
        ]
    },
    {
        "id": "ee4477c3a660cfb6",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "User Input is empty",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 912,
        "y": 560,
        "wires": [
            [
                "89f0d8bb4916ea84"
            ]
        ]
    },
    {
        "id": "62d7e078e0fdd545",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Tip is empty",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 916,
        "y": 640,
        "wires": [
            [
                "89f0d8bb4916ea84"
            ]
        ]
    },
    {
        "id": "0ded7664e38d4c45",
        "type": "switch",
        "z": "7c13b8452619581b",
        "name": "UserInputCl empty \\n UserInputCl OK",
        "property": "UserInputCl",
        "propertyType": "msg",
        "rules": [
            {
                "t": "null"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 694,
        "y": 496,
        "wires": [
            [
                "ca1b95d22899ed5f"
            ],
            [
                "9ec0bad87e7e3ed6"
            ]
        ]
    },
    {
        "id": "9ec0bad87e7e3ed6",
        "type": "switch",
        "z": "7c13b8452619581b",
        "name": "TextInput empty \\n TextInput OK",
        "property": "TextInput",
        "propertyType": "msg",
        "rules": [
            {
                "t": "null"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 684,
        "y": 576,
        "wires": [
            [
                "ee4477c3a660cfb6"
            ],
            [
                "29dd2bc068cbb1f8"
            ]
        ]
    },
    {
        "id": "29dd2bc068cbb1f8",
        "type": "switch",
        "z": "7c13b8452619581b",
        "name": "UserInputTip empty \\n UserInputTip OK",
        "property": "UserInputTip",
        "propertyType": "msg",
        "rules": [
            {
                "t": "null"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 698,
        "y": 656,
        "wires": [
            [
                "62d7e078e0fdd545"
            ],
            [
                "441e35421e46de9c"
            ]
        ]
    },
    {
        "id": "bf23e13acd4755f5",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "UserInputTip",
                "pt": "msg",
                "to": "UserInputTip",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "TextInput",
                "pt": "msg",
                "to": "TextInput",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "UserInputCl",
                "pt": "msg",
                "to": "UserInputCl",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 468,
        "y": 496,
        "wires": [
            [
                "0ded7664e38d4c45",
                "cd1d0d31ac6446e8"
            ]
        ]
    },
    {
        "id": "441e35421e46de9c",
        "type": "debug",
        "z": "7c13b8452619581b",
        "name": "-->> To MSSQL PLUS  -->>",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "UserInputTip & \"/\" & UserInputCl & \"/\" & TextInput",
        "statusType": "jsonata",
        "x": 768,
        "y": 736,
        "wires": []
    },
    {
        "id": "bce72d0f261b67cb",
        "type": "ui_button",
        "z": "7c13b8452619581b",
        "name": "",
        "group": "2733e4a59af46689",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Carica",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 318,
        "y": 496,
        "wires": [
            [
                "bf23e13acd4755f5"
            ]
        ]
    },
    {
        "id": "cd1d0d31ac6446e8",
        "type": "debug",
        "z": "7c13b8452619581b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 438,
        "y": 576,
        "wires": []
    },
    {
        "id": "2733e4a59af46689",
        "type": "ui_group",
        "name": "Inserimento Nuovo Strumento",
        "tab": "fa803f07a50afa29",
        "order": 1,
        "disp": true,
        "width": "9",
        "collapse": false,
        "className": ""
    },
    {
        "id": "fa803f07a50afa29",
        "type": "ui_tab",
        "name": "Inserimento Attrezzature-Strumentazione",
        "icon": "dns",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

NB...

Judging by many of the simple mistakes you made, I definitely recommend you spend some time learning. It will save you (and me) lots of time if you understand what is going on.
Please take a time out to watch the very useful node-red videos :point_down:

Thank a lot and sorry if you wasted time for me.

What about the nodes (I mean dropdown and input text) of input data ? I don't see in your flow

I dont understand what you mean. I used what you sent me.

show me what you mean with screenshots of flow and debug output to explain what you mean?