本文介绍了在Crystal Reports中选择/ Case的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过一个Select语句运行水晶报表,但是我继续在第一次匹配后退出,而不是继续每个案例。

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?

示例

  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值应为7由于每个条件应该已经评估为真,所以select语句的结束,但是它在第一种情况下停止,导致varNumber为1,通常你会有一个break语句来告诉它停止通过每个case语句,但这是isn

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?

推荐答案

你不能使用 select case 来做到这一点,如果你想这样做,你必须构造多个 If 语句或可能的循环

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.

这是什么目的?我不知道我看到的功能的点 - 因为它似乎一直返回7?

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?

这篇关于在Crystal Reports中选择/ Case的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 19:42