4 Replies Latest reply on Feb 23, 2015 3:52 PM by BrianWoods

    Slider Trigger

    BrianWoods

      Title

      Slider Trigger

      Post

      I'm developing a simple database that helps people measure their Body Mass Index then recommends a health program based on the user's BMI (weight/height).

      Once the BMI is calculated, I'd like to send the user directly to one of five panels providing a specific nutritional and exercise program designed for this group.  Panels are entitled: "High", "Medium High", "Medium" etc.

      It would seem appropriate to use IF statements within a script, then a script trigger to activate.  Also tried to use ELSE IF statements ending with ELSE.  However, when implementing either of the last two approaches, the slide control always navigates to one of the last two panels.

      BMI.png

        • 1. Re: Slider Trigger
          philmodjunk

          Correct syntax for checking to see if a value falls in a range between a minimum and maximum value looks like this:

          Health Program::BMI > 3.5 and Health Program::BMI < 4

          A single "chain" of If, Else If, Else If .... Else End If

          steps would make sense here and will work if your range checking expressions are set up correctly, But individual IF - End If pairs will also work and should produce identical results.

          • 2. Re: Slider Trigger
            BrianWoods

            Yep, it worked....Gracias!

            I foresee a similar situation in the not-too-distant future.  So I'm just trying to wrap my head around this.

            I'm at a loss why my calculation didn't work.  It would seem my calculation is fairly simple/straightforward. And the result should fall between the two given values...unless the mathematical expression cannot be evaluated without use of the operator AND. 

            Am I on target...or did I miss something in math class?

            • 3. Re: Slider Trigger
              philmodjunk

              I'm at a loss why my calculation didn't work.

              Allow me to break down how your calculations evaluate step by step. What you used is a 3 term Boolean expression. Boolean expressions evaluate to return a value of True or False and the numeric value of True is 1 and the value of False is 0 when it comes to values returned in this calculation. So let's look at:

              3.5 < Health Program::BMI < 4

              This evaluates from left to right as both operators are at the same "level" when it comes to Order of Operations and since no parenthesis are used. So If we have a value for BMI of 5, here's what happens in your version:

              5 is greater than or equal to 3.5. Thus, the value returned is True, but remember that a value of True is also the numeric value of 1. This value, 1, is then compared to 4. Since 1 is less than 4, the result is True and the script step to go to the "High" object is executed.

              But if you use my expression:

              Health Program::BMI > 3.5 and Health Program::BMI < 4

              then the first comparison of 5 > 3.5 evaluates as True. The second comparison of 5 < 4 evaluates as False. This simplifies to True and False and then evaluates to a final value of False, thus the "Go to object "High" " step is NOT executed.

              • 4. Re: Slider Trigger
                BrianWoods

                As always, many thanks.