Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
216 views
in Technique[技术] by (71.8m points)

Select/Case in Crystal Reports

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

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

1 Reply

0 votes
by (71.8m points)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...