How to change a checkbox control value if you only have the FEQ?

For some reason I always forget this one and have to figure it out each time so I thought I would note it here for future reference!

This is for the situation where you know the FEQ of a CHECK control and want to change the value programmatically.

checkboxFEQ = ?MyCheckbox

! Make sure the checkbox is ticked ON
Change(checkboxFEQ, checkboxFEQ{PROP:TrueValue})

! Toggle the checked state of the checkbox
Change(checkboxFEQ, Choose(checkboxFEQ{PROP:Checked}, checkboxFEQ{PROP:FalseValue}, checkboxFEQ{PROP:TrueValue}))

! Breaking that one liner down a little...
IF checkboxFEQ{PROP:Checked} = TRUE
  Change(checkboxFEQ, checkboxFEQ{PROP:FalseValue})
ELSE
  Change(checkboxFEQ, checkboxFEQ{PROP:TrueValue})
END

Of course I would love to hear of any alternatives or if you spot any problems with this.

1 Like

Several years later and this just saved me lots of time. Thanks!

1 Like