Wix code Boolean to text

Hi
I haven’t done any coding for a while so need some help. I have a database and am trying to add a text box on to the website but depending on whether the ‘SLet’ field in my database field is ticked or not (boolean) I need the text box to write “Rent:” if it is true or “Potential Rent:” if it is false. Please help as I am getting myself in a tizz!!
Thanks.

  1. set text in text box default to “Rent”
  2. in code, do something like this:
    if (boolean_you_are_using) === true {
    $w(“#textboxwithsomename”).text = “Potential Rent”;
    }

Thank you but can not get it to work… What am I doing wrong?
Is ‘boolean_you are using’ the name of the text box as the text box is linked to my field in database called ‘SLet’ (SLet is a boolean).

No, ‘boolean_you are using’ is the value of SLet.
Try the follwing:

let sLet = $w("#myDataset").getCurrentItem().slet; 
//Make sure to use the correct dataset name and field name

if (sLet === false) {
    $w("#textboxwithsomename").text = "Potential Rent";
}

Thank you for helping… but I am still not quite there…
This is how far I have got:


import wixData from ‘wix-data’;
export function RentText_viewportEnter(event, $w) {
let SLet = $w(“#dynamicDataset”).getCurrentItem().SLet;
if (SLet === true) {
$w(“#RentText”).text = “RENT”;}
else { $w(“#RentText”).text = “POT RENT”;}
}

But it is coming out as ‘POT RENT’ on true and false!?
Yours,
tearing my hair out!!