Can I show/hide content from a database on a dynamic item page based off of whether a boolean field is checked?

I have a set of dynamic item pages linked to a dataset. They are a series of custom rebuilt Ford Broncos for sale. What I’d like to do is add a “Sold” field as a boolean to the database that will display a “sold ribbon”(AKA a container box and a text box) on the dynamic pages.

I’m a complete novice when it comes to code…but based off of what I’ve looked into, I tried using this code:

$w( “#broncositem” ).onReady(() => {
let items = $w( “#broncositem” ).getCurrentItem();
if (items[ “Sold” ]) { $w( “#soldtext” ).show(); $w( “#soldbox” ).show(); }
else $w( “#soldtext” ).hide(); $w( “#soldtext” ).hide();
});

The boolean field name is “Sold” and the field key is “broncoStatus”

It seems like it should be a simple thing to display something only on certain items in the database, but I can’t seem to find an easy/good way to do it.

Any help would be appreciated.

@wingcc may have some knowledge on this!

Ops, I just saw this today.
$w( " #Y OUR DYNAMIC DATABASE ID " ).onReady(() => {
let items = $w( " # Y OUR DYNAMIC DATABASE ID " ).getCurrentItem();
if (items.broncoStatus === true) { $w( " #soldtext " ).show(); $w( " #soldbox " ).show(); } else {$w( " #soldtext " ).hide(); $w( " #soldtext " ).hide();});

Let me know if you have any questions!

Happy holidays!

@wingcc hi there, I’m hoping you could help me with this code a bit. Same boat as above but I’m only trying to pull in some text, no container box. Also a novice with code.

When the boolean ‘reserved’ is checked (true), I would like the ‘reservedText’ to show up. See screenshots too. I added an additional dataset because this page is dynamic… not sure if I needed to. Any help is appreciated!

The code I have inserted is:

$w( “#dataset1” ).onReady(() => {

let items = $w( “#dataset1” ).getCurrentItem();

if (items.reserved === true ) { $w( “#reservedText” ).show(); }
else {$w( “#reservedText” ).hide();

}