The task would be to set the value of a variable to +1 and -1 depending on the state of a checkbox.
I want to use the following script:
function test(){
const increment = mainInterface.getProperty("Oldal.chb1.IsChecked") ? 1 : -1;
mainInterface.setVariable("mbus.var1",increment);
}
The function continuously returns a value of "+1" regardless of the state of the checkbox
What could be wrong?
I solved the problem:
let_ertek1= mainInterface.getProperty("Oldal.chb1.IsChecked");
if (let_ertek1 == "true" )
{valt1=1}
else
{valt1=-1}
Great job debugging that! For future reference in QuickHMI, if you ever find a property isn't behaving, logging it to the console with console.log(typeof let_ertek1) is a lifesaver to see if it's actually a string or a boolean.

