# Unexpected match when item doesn't exist

**URL:** <https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068>\
**Category:** Bugs\
**Created:** [July 23, 2018, 3:14am UTC](https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068 "2018-07-23T03:14:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eric1/32/59857_2.png) [@eric1](https://forum.bubble.io/u/eric1)\
**Post date:** [July 23, 2018, 3:14am UTC](https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068/1 "2018-07-23T03:14:06Z")

</div>

I’m pretty sure this is a bug, I logged it on the bug form, just describing here in case it helps anyone debugging their workflows:

It seems that doing a search and evaluating a test on a field with a condition that is negative, eg:

_Do this workflow only when “search for myDataType:first item’s myBoolean is ‘no’”_  
or  
_Do this workflow only when "search for myDataType:first item’s myText is not “some specific text string”_

will incorrectly evaluate as a match and the workflow will run when there are no items in the search.

Doing the same test for a positive condition, such as:

_Do this workflow only when “search for myDataType:first item’s myBoolean is ‘yes’”_

will not match.

Checking to see if an item exists before evaluating the condition avoids this bug.

I made an example app to illustrate: [Editor](https://bubble.io/page?name=index&id=bug-autocreate1&tab=tabs-4), [Runtime](https://bug-autocreate1.bubbleapps.io/version-test?debug_mode=true) Make a copy if you want to play with it since the Bubble team will use it for debugging.

I’m new, if I’m missing something please kindly point it out.

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [July 23, 2018, 3:41am UTC](https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068/2 "2018-07-23T03:41:29Z")

</div>

> [@eric1](#):
>
> Do this workflow only when “search for myDataType:first item’s myBoolean is ‘no’” …  
> when there are no items in the search

`search for myDataType` returns an empty list  
`first item` returns an empty boolean  
`is no` returns yes, because empty is equivalent to no

You probably will get what you intended if you check the count of the returned list.

The way search criteria work with empty fields can be unexpected, but that’s a different topic.

---

<div class="post-metadata">

**Author:** ![eric1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eric1/32/59857_2.png) [@eric1](https://forum.bubble.io/u/eric1)\
**Post date:** [July 23, 2018, 5:09am UTC](https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068/3 "2018-07-23T05:09:32Z")

</div>

“empty is equivalent to no”… _what you say?_ on further research I have discovered this is known as the “truthy / falsey” concept… omg, for a “no-code” platform this is a very geeky subject to wrap our heads around.

Apparently any of the following will give a positive result on a “yes or no” (boolean) test of “is no”:

empty  
null  
undefined  
NaN  
empty string ("")  
number 0  
boolean value “no” (false)

anything else, including the text strings “0”, “false” and “no” will evaluate to “yes”

Yikes.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [August 6, 2018, 3:24am UTC](https://forum.bubble.io/t/unexpected-match-when-item-doesnt-exist/34068/4 "2018-08-06T03:24:59Z")

</div>

Closed on August 6, 2018, 3:24am UTC

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