0

Help with a formula

This formula produces always the Default Text (NOT SPECIFIED)...

The field 'Score' is a Number field.

 

switch number(Score) do
case > 90:
text("EXCELLENT")
case >= 75 and <= 85:
text("SATISFACTORY")
case >= 60 and <= 70:
text("NEEDS IMPROVEMENT")
case >= 45 and <= 55:
text("UNSATISFACTORY")
default:
text("NOT SPECIFIED")

 

Also, I had no luck with

switch Score do...

 

What am I doing wrong?

2 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    Nick, try this...

     

    switch Score > 0 and Score <= 100 do
    case Score >= 90 and Score <= 100:
    "EXCELLENT"
    case Score >= 75 and Score < 90:
    "SATISFACTORY"
    case Score >= 60 and Score < 85:
    "NEEDS IMPROVEMENT"
    case Score >= 45 and Score < 60:
    "UNSATISFACTORY"
    default:
    "NOT SPECIFIED"
    end

     

    It looks like you have to specify the complete range you are testing for in the "switch" part and then test each segment in the "case" part. You left a 5 point gap between case statements so I adjusted for that. Also, you have to include the "Score" field in your case statements.

     

    Sean

    • Nick
    • 4 yrs ago
    • Reported - view

    Thanks a lot Sean 👍

    Works fine! 

Content aside

  • 4 yrs agoLast active
  • 2Replies
  • 1219Views