# Conditional Observables?

**URL:** <https://forums.fusetools.com/t/conditional-observables/4953>\
**Category:** How-to Discussions\
**Created:** [September 26, 2016, 6:09pm UTC](https://forums.fusetools.com/t/conditional-observables/4953 "2016-09-26T18:09:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Oliver](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Daniel\_Oliver](https://forums.fusetools.com/u/Daniel_Oliver)\
**Post date:** [September 26, 2016, 6:09pm UTC](https://forums.fusetools.com/t/conditional-observables/4953/1 "2016-09-26T18:09:09Z")

</div>

I am trying to get the example for conditional observables to work below:

```auto
fruits = Observable(
    { name: 'Apple' , color: 'red' },
    { name: 'Lemon' , color: 'yellow' },
    { name: 'Pear' , color: 'green' },
    { name: 'Banana', color: 'yellow' });

goodFruits = fruits.where({color: 'yellow'});

console.log('Good fruits from object: ' + JSON.stringify(goodFruits));

goodFruits = fruits.where(function(e){
    return e.color === 'yellow';
});

console.log('Good fruits from function: ' + JSON.stringify(goodFruits));

```

But the output from the monitor is:

```auto
LOG: Good fruits from object: {"_subscribers":[],"_isLeaf":false,"_values":[]}
LOG: Good fruits from function: {"_subscribers":[],"_isLeaf":false,"_values":[]}

```

I was expecting something to be in the values for the resulting observable. Is this a bug?

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [September 27, 2016, 2:38am UTC](https://forums.fusetools.com/t/conditional-observables/4953/2 "2016-09-27T02:38:29Z")

</div>

Hi!

This is not a bug, this is expected behavior.

Observables are not like arrays. Observables don’t calculate their values until something _subscribes_ to them. You subscribe by making it part of your module.exports or adding an .onValueChanged listener.

---

<div class="post-metadata">

**Author:** ![Daniel\_Oliver](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Daniel\_Oliver](https://forums.fusetools.com/u/Daniel_Oliver)\
**Post date:** [September 27, 2016, 2:50am UTC](https://forums.fusetools.com/t/conditional-observables/4953/3 "2016-09-27T02:50:52Z")

</div>

That was a great explanation thank you Anders. I was not thinking about Observables in the right way even though I have been working with them for a while now. Thank you!
