# Compare 2 different inputs

**URL:** <https://discourse.nodered.org/t/compare-2-different-inputs/73368>\
**Category:** General\
**Created:** [8 January 2023 13:44 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368 "2023-01-08T13:44:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimC1986](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/timc1986/32/63085_2.png) [@TimC1986](https://discourse.nodered.org/u/TimC1986)\
**Post date:** [8 January 2023 13:44 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/1 "2023-01-08T13:44:17Z")

</div>

Hi all

I need some help, I like to setup a flow with 2 input nodes. node1 is a node with a value range between 0-100 and the other input node2 has a range between 0-5000. I like to configure the flow like: If the input from node 1 is \> 80 the output is 0 no matter whats the input of node 2. If node 1\<80 the output is equale to the value of node 2. I guess this is no rocket science but I'm quite new in node red and still have to learn a lot. I searched for a similar flow on the forum and the rest of the www but no succes . Can someone please help me with these? thanks in advance!

```auto
[
    {
        "id": "0d3e51034b19940d",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "81",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "80",
        "payloadType": "num",
        "x": 190,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "159da3226d0e3b41",
        "type": "debug",
        "z": "525279bd0e36f44d",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 160,
        "wires": []
    },
    {
        "id": "47335ab22f672b33",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1500",
        "payloadType": "num",
        "x": 190,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "42e349d0f425b1d4",
        "type": "inject",
        "z": "525279bd0e36f44d",
        "name": "70",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "70",
        "payloadType": "num",
        "x": 190,
        "y": 140,
        "wires": [
            []
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [8 January 2023 14:48 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/2 "2023-01-08T14:48:15Z")

</div>

Umm did you perhaps not export the whole flow, or is this as far as you've got?

 ![Untitled 4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6d0928c4a7466811433e1639757061728cd77f9.jpeg)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 January 2023 14:54 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/3 "2023-01-08T14:54:09Z")

</div>

Here is a possible layout. have a go , if you have trouble ask specific questions

 ![chrome_screenshot_1673189538624](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b32aac628f27e5fd3b7b573a74c4673a22d07060.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [8 January 2023 14:58 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/4 "2023-01-08T14:58:17Z")

</div>

Darn it, too slow off the mark!  
ps this flow has a "deliberate" error due to not reading the spec ☺

 ![Untitled 5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3dc043ee2dba701a60061a42e35da5ba2c4907b.jpeg)

```auto
[{"id":"a49f67fa0c96285a","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"0d3e51034b19940d","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input1","payload":"81","payloadType":"num","x":120,"y":140,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"159da3226d0e3b41","type":"debug","z":"a49f67fa0c96285a","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":140,"wires":[]},{"id":"47335ab22f672b33","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input2","payload":"1500","payloadType":"num","x":130,"y":260,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"42e349d0f425b1d4","type":"inject","z":"a49f67fa0c96285a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input1","payload":"70","payloadType":"num","x":120,"y":80,"wires":[["7f0aa9e8c6c809b7"]]},{"id":"8847575d365acff5","type":"comment","z":"a49f67fa0c96285a","name":"input 1 0 - 100","info":"","x":130,"y":40,"wires":[]},{"id":"2ecd34ec98d45f56","type":"comment","z":"a49f67fa0c96285a","name":"input 2 0 - 5000","info":"","x":140,"y":300,"wires":[]},{"id":"c6a8ec4cb037c0e2","type":"comment","z":"a49f67fa0c96285a","name":"input 1 > 80, output 0","info":"","x":520,"y":80,"wires":[]},{"id":"18328ac9d74873d0","type":"comment","z":"a49f67fa0c96285a","name":"input 1 < 80, output input 2","info":"","x":530,"y":200,"wires":[]},{"id":"7f0aa9e8c6c809b7","type":"join","z":"a49f67fa0c96285a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":310,"y":140,"wires":[["75407c983cb834f5"]]},{"id":"75407c983cb834f5","type":"switch","z":"a49f67fa0c96285a","name":"","property":"payload.input1","propertyType":"msg","rules":[{"t":"gt","v":"80","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":140,"wires":[["dc6f6bb5fafde2db"],["c0a8fbdfe6fcca6a"]]},{"id":"dc6f6bb5fafde2db","type":"change","z":"a49f67fa0c96285a","name":"","rules":[{"t":"move","p":"payload.input1","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":120,"wires":[["159da3226d0e3b41"]]},{"id":"c0a8fbdfe6fcca6a","type":"change","z":"a49f67fa0c96285a","name":"","rules":[{"t":"move","p":"payload.input2","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":160,"wires":[["159da3226d0e3b41"]]}]

```

---

<div class="post-metadata">

**Author:** ![TimC1986](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/timc1986/32/63085_2.png) [@TimC1986](https://discourse.nodered.org/u/TimC1986)\
**Post date:** [13 January 2023 05:16 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/5 "2023-01-13T05:16:56Z")

</div>

Hi guys, thank you verry much, based your flows I made something that works 😃 I learnd a lot with this about the join and switch node. Thanks!

---

<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:** [14 March 2023 05:17 UTC](https://discourse.nodered.org/t/compare-2-different-inputs/73368/6 "2023-03-14T05:17:12Z")

</div>

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