# Make element show/hide based on dataset boolean value

**URL:** <https://forum.wixstudio.com/t/make-element-show-hide-based-on-dataset-boolean-value/10645>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [November 15, 2022, 4:53pm UTC](https://forum.wixstudio.com/t/make-element-show-hide-based-on-dataset-boolean-value/10645 "2022-11-15T16:53:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![a-kittredge](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@a-kittredge](https://forum.wixstudio.com/u/a-kittredge)\
**Post date:** [November 15, 2022, 4:53pm UTC](https://forum.wixstudio.com/t/make-element-show-hide-based-on-dataset-boolean-value/10645/1 "2022-11-15T16:53:28Z")

</div>

I have a dataset with a boolean field, “vegan”, where some of the items are selected as ‘true’.  
I have a repeater with an icon on each of the repeater items. I want this icon to be hidden if the boolean is ‘false’, and only appear if the item is marked ‘true’.

I’ve tried the code below but can’t seem to get it working.

EDIT: My research has suggested using [Repeated Item Scope](https://www.wix.com/velo/reference/$w/repeater/introduction) . I’m unsure of this, however.

import wixData from ‘wix-data’ ;  
$w . onReady ( function () {

```
wixData . query ( "MenuToppings" ) 
    . find () 
    . then (( results ) => { 

        let boolean = results.items [0]. vegan ; 
        if ( boolean === **true** ) { 
            $w ( "#image44" ). show (); 
        } **else** { 
            $w ( "#image44" ). hide (); 
        } 
    }) 

```

});

---

<div class="post-metadata">

**Author:** ![a-kittredge](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@a-kittredge](https://forum.wixstudio.com/u/a-kittredge)\
**Post date:** [November 15, 2022, 5:12pm UTC](https://forum.wixstudio.com/t/make-element-show-hide-based-on-dataset-boolean-value/10645/2 "2022-11-15T17:12:17Z")

</div>

Changed the scope, now it works:

**import** wixData **from** ‘wix-data’ ;  
$w . onReady (() =\> {  
$w ( “#dataset2” ). onReady (() =\> {  
$w ( “#repeater8” ). onItemReady ( ( $item , itemData ) =\> {  
**if** ( itemData.vegan === **true** ) {  
$item ( “#image44” ). show ();  
}  
});  
});  
});
