How can I get the value of a dropdown node to output to text?

I'm trying to make a selection software, with the value of the dropdown being the price of the labeled item, and I want the actual value to print to a text so the price can be shown and totaled. I've tried using the function nodes to get the value and return it as a new message but I can't seem to get it to work.

It would be helpfull if you provided a simple variaton of your flow showing the problem. As it is, no one but you knows what you have tried or what your code looks like and that makes it hard to suggest a solution.

It's also helpful to provide the versions of NR, node.js and the dashboard (you can get these from the startup log)

NodeRed v.2.2.2
Node.js v16.14.2
Dashboard v3.1.6

I've tried to just directly connect to a text output, as well as write a function that takes the message and turns it into a variable to try and print. This is where I'm at currently:

[
    {
        "id": "e1fde12c.9db918",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "cd36436d.6c672",
        "type": "ui_ui_control",
        "z": "e1fde12c.9db918",
        "name": "",
        "events": "all",
        "x": 520,
        "y": 120,
        "wires": [
            [
                "da61fcfa.21c308"
            ]
        ]
    },
    {
        "id": "9d00ec54.1bcdf",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "PTAC",
        "group": "5fcb0776.c461c8",
        "order": 1,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "PTAC",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_VTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Ecologix\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Units\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\"]}}",
        "payloadType": "json",
        "topic": "",
        "topicType": "str",
        "x": 290,
        "y": 60,
        "wires": [
            [
                "cd36436d.6c672"
            ]
        ]
    },
    {
        "id": "eb6bb9b4.b50a9",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "VTAC",
        "group": "5fcb0776.c461c8",
        "order": 2,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "VTAC",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Non-Inverter\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Units\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_VTAC\"]}}",
        "payloadType": "json",
        "topic": "",
        "topicType": "str",
        "x": 290,
        "y": 120,
        "wires": [
            [
                "cd36436d.6c672"
            ]
        ]
    },
    {
        "id": "b96eb4f0.2b926",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "Reset",
        "group": "5fcb0776.c461c8",
        "order": 3,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "Reset",
        "tooltip": "",
        "color": "",
        "bgcolor": "red",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Units\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_VTAC\"]}}",
        "payloadType": "json",
        "topic": "",
        "topicType": "str",
        "x": 290,
        "y": 180,
        "wires": [
            [
                "cd36436d.6c672"
            ]
        ]
    },
    {
        "id": "da61fcfa.21c308",
        "type": "debug",
        "z": "e1fde12c.9db918",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 120,
        "wires": []
    },
    {
        "id": "73d6e30737c0e3d7",
        "type": "ui_ui_control",
        "z": "e1fde12c.9db918",
        "name": "",
        "events": "all",
        "x": 420,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "7af27ac597ca6036",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "",
        "group": "fc657953.1b728",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Inverter",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Non-Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Ecologix\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_VTAC\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Inverter\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 280,
        "y": 300,
        "wires": [
            [
                "73d6e30737c0e3d7"
            ]
        ]
    },
    {
        "id": "bb0abd0404b40380",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "",
        "group": "fc657953.1b728",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "High Efficiency",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Ecologix\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_VTAC\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Non-Inverter\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 260,
        "y": 380,
        "wires": [
            [
                "73d6e30737c0e3d7"
            ]
        ]
    },
    {
        "id": "2b7df80b1fa06047",
        "type": "ui_dropdown",
        "z": "e1fde12c.9db918",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "8032341740577b9a",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "iPTAC-HEH-09",
                "value": 500,
                "type": "num"
            },
            {
                "label": "iPTAC-HEH-12",
                "value": "600",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "inverter",
        "topicType": "msg",
        "className": "",
        "x": 440,
        "y": 300,
        "wires": [
            [
                "099f6c39ac194f15",
                "3e8371838c9ff792"
            ]
        ]
    },
    {
        "id": "22f024941ae50591",
        "type": "ui_dropdown",
        "z": "e1fde12c.9db918",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "1c069f79f56a8c4e",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "PTAC",
                "value": "PTAC",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic_highefficiency",
        "topicType": "msg",
        "className": "",
        "x": 440,
        "y": 380,
        "wires": [
            [
                "550a1035b3d0c9e7"
            ]
        ]
    },
    {
        "id": "3dfa275ee60f940b",
        "type": "ui_ui_control",
        "z": "e1fde12c.9db918",
        "name": "",
        "events": "all",
        "x": 420,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "6b587d74d2c4cccf",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "",
        "group": "7f74a584.dea814",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Made in Canada",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Non-Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Ecologix\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 260,
        "y": 500,
        "wires": [
            [
                "3dfa275ee60f940b"
            ]
        ]
    },
    {
        "id": "aa80af753acf4297",
        "type": "ui_button",
        "z": "e1fde12c.9db918",
        "name": "",
        "group": "7f74a584.dea814",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Made in China",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_PTAC\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Non-Inverter\",\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Ecologix\"],\"show\":[\"PGNA_PTAC/VTAC_Selection_Software_vAlpha_Chigo\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 260,
        "y": 580,
        "wires": [
            [
                "3dfa275ee60f940b"
            ]
        ]
    },
    {
        "id": "2351ca80b56862a7",
        "type": "ui_dropdown",
        "z": "e1fde12c.9db918",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "64e03a5dbb88aae9",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "VHHC",
                "value": "VHHC",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic_eco",
        "topicType": "msg",
        "className": "",
        "x": 440,
        "y": 500,
        "wires": [
            [
                "dc16874815298e02"
            ]
        ]
    },
    {
        "id": "024a30c258d05051",
        "type": "ui_dropdown",
        "z": "e1fde12c.9db918",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "e7f2d066a9d50890",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "VTAC",
                "value": "VTAC",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic_chigo",
        "topicType": "msg",
        "className": "",
        "x": 440,
        "y": 580,
        "wires": [
            [
                "6afce59e6bb7089d"
            ]
        ]
    },
    {
        "id": "099f6c39ac194f15",
        "type": "debug",
        "z": "e1fde12c.9db918",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 260,
        "wires": []
    },
    {
        "id": "550a1035b3d0c9e7",
        "type": "debug",
        "z": "e1fde12c.9db918",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 420,
        "wires": []
    },
    {
        "id": "dc16874815298e02",
        "type": "debug",
        "z": "e1fde12c.9db918",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 460,
        "wires": []
    },
    {
        "id": "6afce59e6bb7089d",
        "type": "debug",
        "z": "e1fde12c.9db918",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 620,
        "wires": []
    },
    {
        "id": "3e8371838c9ff792",
        "type": "function",
        "z": "e1fde12c.9db918",
        "name": "",
        "func": "var newMsg = msg.inverter;\nvar newMsg = JSON.parse(newMsg);\nreturn newMsg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 320,
        "wires": [
            [
                "ecd5cc13739161c3"
            ]
        ]
    },
    {
        "id": "ecd5cc13739161c3",
        "type": "ui_text",
        "z": "e1fde12c.9db918",
        "group": "8032341740577b9a",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "x": 790,
        "y": 320,
        "wires": []
    },
    {
        "id": "2e65b7dec7e4e48a",
        "type": "ui_spacer",
        "z": "e1fde12c.9db918",
        "name": "spacer",
        "group": "f033628c.9c7ce",
        "order": 3,
        "width": 5,
        "height": 1
    },
    {
        "id": "1d58aa175d2787a9",
        "type": "ui_spacer",
        "z": "e1fde12c.9db918",
        "name": "spacer",
        "group": "5fcb0776.c461c8",
        "order": 4,
        "width": 2,
        "height": 1
    },
    {
        "id": "5fcb0776.c461c8",
        "type": "ui_group",
        "name": "Units",
        "tab": "7dfaf7ff.8d5ae",
        "order": 1,
        "disp": true,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "fc657953.1b728",
        "type": "ui_group",
        "name": "PTAC",
        "tab": "7dfaf7ff.8d5ae",
        "order": 3,
        "disp": true,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "8032341740577b9a",
        "type": "ui_group",
        "name": "Inverter",
        "tab": "7dfaf7ff.8d5ae",
        "order": 5,
        "disp": true,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "1c069f79f56a8c4e",
        "type": "ui_group",
        "name": "Non-Inverter",
        "tab": "7dfaf7ff.8d5ae",
        "order": 6,
        "disp": true,
        "width": 11,
        "collapse": false,
        "className": ""
    },
    {
        "id": "7f74a584.dea814",
        "type": "ui_group",
        "name": "VTAC",
        "tab": "7dfaf7ff.8d5ae",
        "order": 4,
        "disp": true,
        "width": "11",
        "collapse": false,
        "className": ""
    },
    {
        "id": "64e03a5dbb88aae9",
        "type": "ui_group",
        "name": "Ecologix",
        "tab": "7dfaf7ff.8d5ae",
        "order": 6,
        "disp": true,
        "width": 11,
        "collapse": false,
        "className": ""
    },
    {
        "id": "e7f2d066a9d50890",
        "type": "ui_group",
        "name": "Chigo",
        "tab": "7dfaf7ff.8d5ae",
        "order": 7,
        "disp": true,
        "width": 10,
        "collapse": false,
        "className": ""
    },
    {
        "id": "7dfaf7ff.8d5ae",
        "type": "ui_tab",
        "name": "PGNA PTAC/VTAC Selection Software vAlpha",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

can you explain what buttons you push, which field you enter etc?

If I connect the output from your dropdown node directly to your text node, the selected value is displayed in the text.

So can you say more clearly what it is that doesn't work for you?

Apologies, I'd like t have that text value then print to a seperate sheet with all the values, like an "add to cart" function. Id also like some of the values to be multiplied based on the selected quantity

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