水晶报告公式,以获得学生的成绩

时间:2016-06-05 20:26:22

标签: crystal-reports

我想通过计算获得的总分数和总分最大分数来显示学生的成绩。 我写下面给出的公式:

local stringVar div := "";
local numberVar num := (ToNumber({StudentResult.S1To})+ToNumber({StudentResult.S2To})+ToNumber({StudentResult.S3To})+ToNumber({StudentResult.S4To})+ToNumber({StudentResult.S5To}))*100/
(ToNumber({StudentResult.S1M})+ToNumber({StudentResult.S2M})+ToNumber({StudentResult.S3M})+ToNumber({StudentResult.S4M})+ToNumber({StudentResult.S5M}))
If num < 33 Then
(
   div := "FAILED";
)
Else If num >= 33 And num < 45 Then
(
   div := "THIRD";
)
Else If num >= 45 And num < 60 Then
(
   div := "SECOND";
)
Else
(
   div := "FIRST";
);

此代码在if else部分出现错误。如果有人知道,请帮助我在编写代码时犯错。感谢

1 个答案:

答案 0 :(得分:1)

local stringVar div := "";
local numberVar num := (ToNumber({StudentResult.S1To})+ToNumber({StudentResult.S2To})+ToNumber({StudentResult.S3To})+ToNumber({StudentResult.S4To})+ToNumber({StudentResult.S5To}))*100/
(ToNumber({StudentResult.S1M})+ToNumber({StudentResult.S2M})+ToNumber({StudentResult.S3M})+ToNumber({StudentResult.S4M})+ToNumber({StudentResult.S5M}));

If num < 33 Then
(
   div := "FAILED";
)
Else If num >= 33 And num < 45 Then
(
   div := "THIRD";
)
Else If num >= 45 And num < 60 Then
(
   div := "SECOND";
)
Else
(
   div := "FIRST";
);