Toggle Button Logic

Hi All. I am using a series of toggle buttons to determine what health characteristics are present for a patient. I would like the user to be able to tap those that are present so they are used in a formula to calculate the patient’s risk of disease…and I have that part of it working. However, when the toggle button is tapped again (to indicate the health characteristic is NOT present after is has already been tapped on, for example) the formula won’t update to reflect it. Seems like this should be simple but I am obviously missing something. I have inserted a screen shot of the logic flow for one of the health characteristics (Pre-Term) below.

What is inside the IF condition?
There should be a check for the self.value as that reflects the value of the toggle.

However, if I get the use case correct you could simply use something like this:

There is an IF formula in the set app variable. (Assuming You use “number” format for the premieCoef appvar) Following:
IF(self.value==true, 0.79017, 0)

The last set page variable is also an IF formula (Assming You use true/false type for the boolPremie pagevar.):
IF(appVars.premieCoef==0, false, true)

Hope it helps, let us know. :smiley:

1 Like

Looks like you have true inside the if condition, which means the 1st output will always be triggered.

If boolPremie is a true/false type variable, you can place that inside the if condition. Then the 2nd output will trigger if boolPremie is false.

1 Like

Thanks so much Mihaly! This is just what I needed and it works great now.

1 Like

Got it Mari. Thanks for the tip!

1 Like