开发者

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:开发者_JAVA百科
         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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜