# How to do conditional compare to payload item with zero items?

**URL:** <https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523>\
**Category:** Help\
**Tags:** workflow\
**Created:** [January 8, 2020, 8:03am UTC](https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523 "2020-01-08T08:03:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Chase](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@Bryan\_Chase](https://forums.losant.com/u/Bryan_Chase)\
**Post date:** [January 8, 2020, 8:03am UTC](https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523/1 "2020-01-08T08:03:49Z")

</div>

Instead of `{{working.webapi.body}} === "[]"` I’ve tried these things (I’m 99% sure):

`{{working.webapi.body}} === null`  
`{{working.webapi.body}} === "null"`  
`{{working.webapi.body}} === 0`  
`{{working.webapi.body}} === []`  
`{{working.webapi.body}} == null`  
`{{working.webapi.body}} == "null"`  
`{{working.webapi.body}} == 0`  
`{{working.webapi.body}} == []`  
`{{working.webapi.body.count}} === 0`  
`{{working.webapi.body.count}} == 0`

How to do a conditional based on this: ?  
`"body" : [] 0 items`

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [January 8, 2020, 2:30pm UTC](https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523/4 "2020-01-08T14:30:33Z")

</div>

@Bryan_Chase,

The correct way would be: `{{ data.array.length }} === 0`

It stems from [Javascript](https://www.w3schools.com/jsref/jsref_length_array.asp). I’m making a note to add this to the docs to make it clearer.

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [January 8, 2020, 2:37pm UTC](https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523/5 "2020-01-08T14:37:31Z")

</div>

@Bryan_Chase,

Actually, I retract my statement. Not that it wouldn’t work, i’d just like to recommend something else. I’d recommend you use [Handlebar](https://handlebarsjs.com/guide/) helpers in situations like this:

`{{length data.array}} == 0`

or

`{{length data.array}} === "0"`

You can see more helpers in this doc:

> **[Accessing Payload Data](https://docs.losant.com/workflows/accessing-payload-data/)**
>
> Learn more about Losant workflows: how to work with and access payload data.

---

<div class="post-metadata">

**Author:** ![Bryan\_Chase](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@Bryan\_Chase](https://forums.losant.com/u/Bryan_Chase)\
**Post date:** [January 8, 2020, 6:22pm UTC](https://forums.losant.com/t/how-to-do-conditional-compare-to-payload-item-with-zero-items/2523/6 "2020-01-08T18:22:33Z")

</div>

They both work, thanks!
