# Pass data throught a button to SQL Table

**URL:** <https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649>\
**Category:** General\
**Created:** [10 March 2022 10:30 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649 "2022-03-10T10:30:21Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [11 March 2022 12:05 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/24 "2022-03-11T12:05:10Z")

</div>

I mean the part you shown in the first picture where input are required

This is what I see importing your flow

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55e2f049e5b81be71cdbdf5cd380a708d55c4b2d.png)

Does the input data (dropdown and input text) remain equal?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 March 2022 12:06 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/25 "2022-03-11T12:06:20Z")

</div>

Ah, apologies.

```auto
[
    {
        "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": "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": "46b4474ec3fa7473",
        "type": "ui_dropdown",
        "z": "7c13b8452619581b",
        "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": 342,
        "y": 272,
        "wires": [
            [
                "46669bdc7ad95e55"
            ]
        ]
    },
    {
        "id": "a6b5e5dadea9aa3b",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "TextInput",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 538,
        "y": 336,
        "wires": [
            []
        ]
    },
    {
        "id": "fcfa9bd412d25121",
        "type": "ui_text_input",
        "z": "7c13b8452619581b",
        "name": "",
        "label": "User Input",
        "tooltip": "",
        "group": "2733e4a59af46689",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "50",
        "topic": "",
        "sendOnBlur": false,
        "className": "",
        "topicType": "str",
        "x": 338,
        "y": 336,
        "wires": [
            [
                "a6b5e5dadea9aa3b"
            ]
        ]
    },
    {
        "id": "bffd5199f28bef9f",
        "type": "ui_dropdown",
        "z": "7c13b8452619581b",
        "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": "",
        "topicType": "str",
        "className": "",
        "x": 364,
        "y": 400,
        "wires": [
            [
                "ad8dfbbda055fbc4"
            ]
        ]
    },
    {
        "id": "ad8dfbbda055fbc4",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "UserInputCl",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 604,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "46669bdc7ad95e55",
        "type": "change",
        "z": "7c13b8452619581b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "UserInputTip",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 548,
        "y": 272,
        "wires": [
            []
        ]
    },
    {
        "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": "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": "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": "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": "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": "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": "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": "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
    }
]

```

---

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [14 March 2022 15:16 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/26 "2022-03-14T15:16:56Z")

</div>

Thank a lot Steve.

Could you suggest me some post or link where I can see how to make a comparison between an input text and the result of a query made to an SQL table?  
The result of the query is a column extracted from an SQL Table in which each raw corrispond to a string to which my input text needs to be compared. If the new inserted text input (CODIFICA) is equal to one of the already existing I need to give a message and ask to choose another input text.

See example:

| QUERY RESULT | | | VALID INPUT TEXT | | NOT VALID INPUT TEXT |
| --- | --- | --- | --- | --- | --- |
| AAA | | | FFF | | CCC |
| BBB | | | | | |
| CCC | | | | | |
| BGA1 | | | | | |
| BGA2 | | | | | |

When a NOT valid input text is inserted, an alert message must be displayed.

In the above flow there is the check if the input text is empty, I need to add the described other check.

Thank a lot

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 March 2022 15:23 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/27 "2022-03-14T15:23:32Z")

</div>

Is your previous question resolved?

This looks like a new question.

---

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [14 March 2022 15:25 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/28 "2022-03-14T15:25:59Z")

</div>

Yes it is.

It is linked to the same flow but different topic  
Should I open another post?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 March 2022 15:31 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/29 "2022-03-14T15:31:21Z")

</div>

> [@QGIO](#):
>
> Should I open another post?

Please, yes. Mark this thread as solved & if necessary, link back to it for reference.

I would also recommend you set a reasonable title like "How to check user input text is not in already in SQL results" - that should attract the right users to help you out.

---

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [15 March 2022 08:43 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/30 "2022-03-15T08:43:25Z")

</div>

Hello Steve,

regarding this post, I have the following problem.  
In my flow, there is a notification in case of empty input.

This works only if I try to fill and then cancel the input, but if I leave blanks the fields as they appear the first time, no notification is shown and null data are saved in the SQL table.

What can be the problem?

Many thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 March 2022 09:09 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/31 "2022-03-15T09:09:55Z")

</div>

No idea. Add debug nodes to every node (best off giving them useful names too) & see what happens as you try these steps - you should be able to identify where it goes wrong. If not, you will at least have more info to share on the forum for others to help you with.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 March 2022 09:10 UTC](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649/32 "2022-03-29T09:10:22Z")

</div>

Closed on 29 March 2022 09:10 UTC

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

[Previous page](https://discourse.nodered.org/t/pass-data-throught-a-button-to-sql-table/59649.md?page=1)
