水晶报告错误:“此处需要字符串”在选择 [英] crystal report error: "a string is required here" on select
问题描述
我在Crystal报表中运行以下代码,它告诉我
I run the following code in crystal reports and it tells me that
此处需要字符串
" string is required here"
第二种情况。我尝试将{?Pm-Student_course_attendance_csv.Level}转换为字符串,但是没有运气
on the second case. I've tried casting {?Pm-Student_course_attendance_csv.Level} as a string, but no luck
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;
推荐答案
您的公式不能有两种不同的返回类型。从错误及其上方返回一个字符串,但是在错误下方,您尝试返回一个数字(公式的返回类型也是最后一个赋值,因此,如果您的公式最后执行的操作是 grade:= 1
,那么该公式将尝试返回值1,这显然是不允许您这样做的。您必须在公式的后半部分为每种情况添加一个字符串返回值。
Your formula cannot have two different return types. From the error and above it returns a string, but below it you are trying to return a number (A formula's return type is also the last assignment, so if the last thing your formula does is grade:=1
then the formula tries to return the value 1, which it obviously won't allow you to do. You have to add a string return value for each case in the second half of the formula.
...
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":
...
这篇关于水晶报告错误:“此处需要字符串”在选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!