3 Replies Latest reply on Jun 7, 2011 11:06 AM by deepakgupta_1

    Value list-related calculation problem

    deepakgupta_1

      Title

      Value list-related calculation problem

      Post

      Dear all,

      I have a drop-down field that has visual acuity values, listed as 6/6+, 6/6, 6/6- etc.

      In need to round the selected visual acuity so that 6/6+ OR 6/6 OR 6/6- all are equivalent to 6/6.

      I set up a calculation field to do this using a case function as follows...

      Case  (PreOp VA="HM" ; "HM" ;  PreOp VA="CF" ; "CF" ; PreOp VA="6/60+";  "6/60"; PreOp VA="6/60" ; "6/60"; PreOp VA="6/60-" ; "6/60"; PreOp VA="6/36+"; "6/36";  PreOp VA="6/36"; "6/36";   PreOp VA="6/36-" ; "6/36"; PreOp VA="6/24+"; "6/24"; PreOp VA="6/24"; "6/24" ; PreOp VA="6/24-" ; "6/24";  PreOp VA= "6/18+"; "6/18";  PreOp VA= "6/18"; "6/18"; PreOp VA="6/18-" ; "6/18" ;   PreOp VA= "6/12+";"6/12";  PreOp VA="6/12";"6/12";  PreOp VA="6/12-";"6/12"; PreOp VA= "6/9+";"6/9";  PreOp VA="6/9"; "6/9";  PreOp VA="6/9-" ; "6/9"; PreOp VA= "6/6+";"6/6"; PreOp VA= "6/6"; "6/6"; PreOp VA= "6/6-";"6/6"; "" )

      (I initially used an OR function to shorten the calculation but this did not work, so in the above I have tediously listed out all the individual values and their equivalent.)

      The result is that only if HM or CF  selected as PreOp VA,  I get HM and CF.  All other values selected from the drop down list result in 6/60.

      What am I doing wrong?

      THanks in advance.

        • 1. Re: Value list-related calculation problem
          Abhaya

          Hi deepak,

          Its a simple one.so please check some thing

          1> The field mustnot  be a calculation type means the case  condition must be  in the Auto enter calculation field and there  plz uncheck the

          Box Do not replace existing value of field(if any) .

          then see the result.i am getting it in my Demo so you'll get it.

          Thanks

          • 2. Re: Value list-related calculation problem
            philmodjunk

            Long case statements are much easier to work with if you re-arrange them to look like this:

            Case (PreOp VA="HM" ; "HM" ;
                     PreOp VA="CF" ; "CF" ; 
                     PreOp VA="6/60+"; "6/60";
                     PreOp VA="6/60" ; "6/60";
                     PreOp VA="6/60-" ; "6/60";
                     PreOp VA="6/36+"; "6/36";
                     PreOp VA="6/36"; "6/36";
                     PreOp VA="6/36-" ; "6/36";
                     PreOp VA="6/24+"; "6/24";
                     PreOp VA="6/24"; "6/24" ;
                     PreOp VA="6/24-" ; "6/24";
                     PreOp VA= "6/18+"; "6/18";
                     PreOp VA= "6/18"; "6/18"; 
                     PreOp VA="6/18-" ; "6/18" ;
                     PreOp VA= "6/12+";"6/12";
                     PreOp VA="6/12";"6/12";
                     PreOp VA="6/12-";"6/12";
                     PreOp VA= "6/9+";"6/9";
                     PreOp VA="6/9"; "6/9";
                     PreOp VA="6/9-" ; "6/9";
                     PreOp VA= "6/6+";"6/6";
                     PreOp VA= "6/6"; "6/6"; 
                     PreOp VA= "6/6-";"6/6";
                     "" 
                    )

            There is nothing in your case statement that would explain why you are seeing 6/60 for all values other than "HM" and "CF", but here's a simpler Case function that should return the same values as the above function:

            Case (PreOp VA="HM" ; "HM" ;
                     PreOp VA="CF" ; "CF" ; 
                     Filter ( PreOp VA ; "0123456789/" )
                    )

            The filter expression will strip out the + and - while leaving the numerals and / unchanged.

            • 3. Re: Value list-related calculation problem
              deepakgupta_1

              Dear Atauf, I tried putting it in as you suggested (i.e. in an auto-enter type) but it still did not work.  For some reason, after re-trying it as a calculation field it has worked.  Not sure why it did not work the first time for me.

              Dear PhilModJunk, thanks for introducing the filter function.  It worked in a calculation-type field.  And, yes I did list the function originally as you suggested, it came out the way it did after copying and pasting....

              Many thanks to both of you,

              Regards