# Isolate a value

**URL:** https://discourse.nodered.org/t/isolate-a-value/4661
**Category:** General
**Created:** [7 November 2018 22:12 UTC](https://discourse.nodered.org/t/isolate-a-value/4661 "2018-11-07T22:12:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rogier](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@rogier](https://discourse.nodered.org/u/rogier)
#### Post date: [7 November 2018 22:12 UTC](https://discourse.nodered.org/t/isolate-a-value/4661/1 "2018-11-07T22:12:05Z")

</div>

Hello,  
Iam looking for a solution to isolate a "value" with the Function Node. The Node have 2 outputs.  
The value is 0 or 1,  
If it is 0 a output must deploy a 1, the other output does nothing  
if de value is 1 the other output becomes 1. the other output does nothing  
the input of the Function is:

{"len":11,"objectId":{"type":3,"instance":0},"property":{"id":85,"index":4294967295},"values":[{"type":9,"value":1}]}

thanks.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [8 November 2018 09:12 UTC](https://discourse.nodered.org/t/isolate-a-value/4661/2 "2018-11-08T09:12:16Z")

</div>

If you feed that into a debug node, select the property you are interested in (the 1 in this case) and hover over it then some little buttons appear to the right. One of those when clicked will say Path Copied (the leftmost button I think). If you paste that somewhere you will see how to access the value property. Having done that you can do what you want in a function but you could use a Change node set to Move that property into msg.payload, then a Switch node to test the value and send the message on to the appropriate output.

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [8 November 2018 12:34 UTC](https://discourse.nodered.org/t/isolate-a-value/4661/3 "2018-11-08T12:34:04Z")

</div>

this page in the docs is worth a read  
[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

### Author: ![machadotiago](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/machadotiago/32/23776_2.png) [@machadotiago](https://discourse.nodered.org/u/machadotiago)
#### Post date: [8 November 2018 19:19 UTC](https://discourse.nodered.org/t/isolate-a-value/4661/4 "2018-11-08T19:19:37Z")

</div>

For this kind of problem you don't need a function Node. Try to do this using the "Switch" node (add 2 outputs to it and configure it to look for msg.value) and after the Switch use 2 "Change" nodes.

Actually the function Node is used only in **extreme** cases. In 90% of the cases you can play with Switch (as an "if"), with Split and Join(as a "for") and with Change (as a value changer). Trust me, once you learn how to use those 4 nodes your life will change forever.
