Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to have crystal reports run through a Select statement however I keeps on dropping out after hitting the first match instead of continuing on through each case. How can I get it to evaluate each condition on it's own merits instead of it automaticaly breaking after finding the first match?

Example

  local numbervar varNumber := 0; 
    Select 7
      case is <= 1:
         varNumber := varNumber + 1   //Only gets to here
      case is <= 2:
         varNumber := varNumber + 1
      case is <= 3:
         varNumber := varNumber + 1
      case is <= 4:
         varNumber := varNumber + 1
      case is <= 5:
         varNumber := varNumber + 1
      case is <= 6:
         varNumber := varNumber + 1
      case is <= 7:
         varNumber := varNumber + 1
   End Select

varNumber value should be 7 by the end of the select statement as each condition should have evaluated true, however it stops after hitting the first case, resulting in varNumber being 1, normally you would have a break statement to tell it to stop falling through each case statement, but this isn't happening.

Alternatively is there a way to simulate this functionality?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
209 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can't do this using select case if you wanted to do this you would have to construct multiple If statements or possibly a loop.

What is the purpose of this? I'm not sure I see the point of the function - as it appears to return 7 all the time?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...