2012-11-09 57 views
1

我跑在Crystal Reports下面的代碼,它告訴我,水晶報表錯誤:「字符串這裏需要」上選擇

" string is required here"

在第二殼上。我試過鑄造{?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; 
+0

什麼類型的字段?(參數{?PM-Student_course_attendance_csv .Level}和看起來像db字段{PM_csv.mv_value}) – Krease

+0

所有類型字符串 – pluke

回答

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": 
... 
+0

謝謝,解決了它 – pluke