# Checking if boolean in collection is true then...

**URL:** <https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [September 30, 2018, 11:17pm UTC](https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970 "2018-09-30T23:17:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbelgrave](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tbelgrave/32/780_2.png) [@tbelgrave](https://forum.wixstudio.com/u/tbelgrave)\
**Post date:** [September 30, 2018, 11:17pm UTC](https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970/1 "2018-09-30T23:17:19Z")

</div>

Hiya all, I’m a total Wix Code newbie and was wondering if I could get some guidance.  
As the title states I would like to check if a boolean value is true/false in my collection and if true it shows an image and false it stays hidden; Obviously the below is totally wrong but I’ve been trying for an hour or so with no further then when I started. Would appreciate any help! Would love to add in this little future in my back-end.  
Code below thx!

```javascript
wixData.query("profile")
  .eq("yardPr", "true")
  .find()
  .then( (results) => {
 let isHidden = $w("#10yPrIMG").hidden; // false
 if( $w("#10yPrIMG").hidden ) {
  $w("#10yPrIMG").show();
}
else {
  $w("#10yPrIMG").hide();
}
  } )
  .catch( (error) => {
 let errorMsg = error.message;
 let code = error.code;
  } );

```

---

<div class="post-metadata">

**Author:** ![giri-zano](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/giri-zano/32/80469_2.png) [@giri-zano](https://forum.wixstudio.com/u/giri-zano)\
**Post date:** [October 1, 2018, 7:53pm UTC](https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970/2 "2018-10-01T19:53:00Z")

</div>

Try this:

```javascript
wixData.query("profile")
  .eq("yardPr", true)

```

---

<div class="post-metadata">

**Author:** ![tbelgrave](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tbelgrave/32/780_2.png) [@tbelgrave](https://forum.wixstudio.com/u/tbelgrave)\
**Post date:** [October 1, 2018, 10:03pm UTC](https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970/3 "2018-10-01T22:03:41Z")

</div>

Oh man thx, it’s always the small things doh! Ok that part cleared up, it still doesn’t detect if the value is true or false unfortunately. I think my above code hard codes the boolean value to be true or false? Thx for your help.

---

<div class="post-metadata">

**Author:** ![\_or](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/_or/32/1004_2.png) [@\_or](https://forum.wixstudio.com/u/_or)\
**Post date:** [October 2, 2018, 7:53am UTC](https://forum.wixstudio.com/t/checking-if-boolean-in-collection-is-true-then/3970/4 "2018-10-02T07:53:36Z")

</div>

Hi,  
What field in the database saves the boolean value? you should use that in the if statement instead “$w(” [#10yPrIMG](https://www.wix.com/code/home/forum/search/posts%3Fquery=%2310yPrIMG) “).hidden;”. I’d also recommend you to check out [this](https://support.wix.com/en/wix-code/wix-code-basics) articles about wix code basics.
