Reputation: 4346
I run the following code in crystal reports and it tells me that
" string is required here"
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;
Upvotes: 1
Views: 6880
Reputation: 7287
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":
...
Upvotes: 2