3 Replies Latest reply on Mar 13, 2012 2:51 PM by matyson

    If statement or Case statement help

    matyson

      I have put the following statement into a number field with a drop down box choosing the word (to ensure correct spelling) but the only answer I am getting back is "?":

      Case(Eye Response = "Spontaneously"; 4;

      Eye Response="To Speech"; 3;

      Eye Response="To Pain"; 2;

      Eye Response="None"; 1)

       

      I have it in auto entery now, but tried it in validation with the same result.

      Please help - not sure if my syntax is wrong or spacing in field is wrong, or what else.

       

      Thanks, Mary

        • 1. Re: If statement or Case statement help
          comment

          I think you want to use two fields: a Text field named Eye Response, and a Calculation field with the above formula and the result type set to Number..

          • 2. Re: If statement or Case statement help
            PeterEvans

            Hi Mary

             

            The case statement work from top to bottoma bit  like nested ifs.  The syntax is:=

             

            Case(

            Test 1; Result 1;

            Test 2; Result 2;

            Test 3; Result 3;

            Default Result)

             

            Unlike if statements, as  soon as a test is true then the result is given and the  statement drops out and no other part of the statement is tested.

             

            For your problem you should have a drop down on the TEXT field 'Eye Response' from a value list with

            Spontaneously, To Speech, To Pain and None. 

             

            You then need another field for your case statement called something like Response Result and define it as a calculation

             

            Case (

            Eye Response ="Spontaneously"; 4;

            Eye Response="To Speech"; 3;

            Eye Response="To Pain"; 2;

            1 )

             

            That should sort you out.

             

            Cheers

            • 3. Re: If statement or Case statement help
              matyson

              Thank you so much.  It worked well.  Mary