1

我在水晶报告中运行以下代码,它告诉我

“这里需要字符串”

在第二种情况下。我尝试将 {?Pm-Student_course_attendance_csv.Level} 转换为字符串,但没有运气

 Global NumberVar grade;
 Global NumberVar baseline;

Select ({?Pm-Student_course_attendance_csv.Level})
  Case "R", "TL", "TU", "OTH", "P", "BTECFS": 
    If (CStr({PM_csv.mv_value}) = "Pass") Then
       "On Track"
    Else
       "Below"

  Case "H", "ASD", "AD", "AS", "G":     //error from this line onwards inclusive
     Select (CStr({PM_csv.mv_value}))
        Case "A*":
            grade := 11
        Case "A*/A":
            grade := 10
        Case "A":
            grade := 9
        Case "A/B":
            grade := 8
        Case "B":
            grade := 7
        Case "B/C":
            grade := 6
        Case "C":
            grade := 5
        Case "C/D":
            grade := 4
        Case "D":
            grade := 3
        Case "D/E":
            grade := 2
        Case "E":
            grade := 1
        Case "U":
            grade := 0
        Default :
            grade := 0;
4

1 回答 1

2

您的公式不能有两种不同的返回类型。从错误和上面它返回一个字符串,但在它下面你试图返回一个数字(公式的返回类型也是最后一个赋值,所以如果你的公式做的最后一件事是grade:=1那么公式试图返回值 1,这显然不允许您这样做。您必须在公式的后半部分为每个案例添加一个字符串返回值。

...
  Case "H", "ASD", "AD", "AS", "G":     //error from this line onwards inclusive
     Select (CStr({PM_csv.mv_value}))
        Case "A*":
            grade := 11;
            "Return value" //<---- Must be a string
        Case "A*/A":
...
于 2012-11-09T17:49:38.117 回答