在Crystal Reports中将课程相加到公式中。

huangapple go评论55阅读模式
英文:

Adding Courses together in formula in Crystal Reports

问题

我正在为我们学校创建一个自定义成绩单,在报告的底部,我需要将所有课程的学分累加在一起,称为“获得的学分”。大多数课程每门为1学分,但也有一些课程为半学分。

我已经开始创建一个相应的公式,它运行得很好,但现在开始变得复杂,因为学生可能有各种不同的变化。哈哈。

是否有更简单的方法来做到这一点?谢谢。

到目前为止,我有以下内容:

.5学分 - 物理、生物、化学、个人项目、辩论I/II、电影导论、MMUN

如果 {Export_20230208T155906_.Comment} 为null,则计数 {Export_20230208T155906_.Course Title}
否则
如果 {Export_20230208T155906_.Course Title} = "个人项目" 并且 {Export_20230208T155906_.Comment} = "生物:0.5" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Course Title} = "个人项目" 并且 {Export_20230208T155906_.Comment} = "化学:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1.5
否则
如果 {Export_20230208T155906_.Course Title} = "个人项目" 并且 {Export_20230208T155906_.Comment} = "生物:0.5学分 化学:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 2
否则
如果 {Export_20230208T155906_.Course Title} = "IB MYP电影导论1" 并且 {Export_20230208T155906_.Comment} = "生物:0.5" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Course Title} = "IB MYP电影导论1" 并且 {Export_20230208T155906_.Comment} = "化学:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1.5
否则
如果 {Export_20230208T155906_.Comment} = "生物:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 0.5
否则
如果 {Export_20230208T155906_.Comment} = "化学:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 0.5
否则
如果 {Export_20230208T155906_.Comment} = "物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 0.5
否则
如果 {Export_20230208T155906_.Comment} = "生物:0.5学分 化学:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Comment} = "生物:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Comment} = "化学:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Comment} = "生物:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1
否则
如果 {Export_20230208T155906_.Comment} = "生物:0.5学分 化学:0.5学分 物理:0.5学分" 则计数 {Export_20230208T155906_.Course Title} + 1.5

希望这可以帮助你。

英文:

I'm creating a custom Transcript for our school and at the bottom of the report I need to add all the courses together for "Credits Earned". Most are 1 point each, but then there are a few that are half points.

I started creating a formula for this and it works just fine, but now it's starting to get confusing with all the different variations the student could have. haha.

Is there a simpler way of doing this? Thanks.

Here's what I have so far:

.5 credit are - Physics, Bio, Chemistry, Personal Project, Debate I/II, Intro to Film, MMUN

If isnull ({Export_20230208T155906_.Comment}) then Count ({Export_20230208T155906_.Course Title})
else
If {Export_20230208T155906_.Course Title} = "Personal Project" 
and {Export_20230208T155906_.Comment} = "Biology: .5" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Course Title} = "Personal Project" 
and {Export_20230208T155906_.Comment} = "Chemistry: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1.5 
else
If {Export_20230208T155906_.Course Title} = "Personal Project" 
and {Export_20230208T155906_.Comment} = "Biology: .5 credit Chemistry: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 2 
else
If {Export_20230208T155906_.Course Title} = "IB MYP Intro to Film 1" 
and {Export_20230208T155906_.Comment} = "Biology: .5" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Course Title} = "IB MYP Intro to Film 1" 
and {Export_20230208T155906_.Comment} = "Chemistry: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1.5 
else
If {Export_20230208T155906_.Comment} = "Biology: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + .5 
else
If {Export_20230208T155906_.Comment} = "Chemistry: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + .5 
else
If {Export_20230208T155906_.Comment} = "Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + .5 
else
If {Export_20230208T155906_.Comment} = "Biology: .5 credit Chemistry: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Comment} = "Biology: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Comment} = "Chemistry: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Comment} = "Biology: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1 
else
If {Export_20230208T155906_.Comment} = "Biology: .5 credit Chemistry: .5 credit Physics: .5 credit" then Count ({Export_20230208T155906_.Course Title}) + 1.5 

答案1

得分: 0

为什么不在导出中包括每门课程的学分数?然后你只需简单地对该列中的值求和。

如果由于某种奇怪的原因你的数据库中没有该数值,应该将其添加到数据库中。

这将消除你需要在报告中分配学分值给课程的需求。

英文:

Why not include in the export the number of credits for each course? You can then simply sum the value in that column.

If for some odd reason your database doesn't have that value, it should be added to your database.

That would remove the need for you to assign credit values to courses in your reporting.

答案2

得分: 0

如果您无法访问该值,一种选择是创建自己的表格并加入它。这将允许您将分配正确值的责任委托给学术方面的某人。

否则,如果您必须在Crystal公式中维护这个逻辑,那么只需创建一个详细级别的公式,返回该行的学分数量。然后,在您需要的任何分组级别(例如学生、DEPT、总计)上简单地对该公式求和。无需使用变量累积该值。

此外,详细级别的公式可以使用OR逻辑来避免太多分支。避免使用太多IF THEN分支的另一个出色机制是使用SELECT CASE语句。

英文:

If you can't access that value, one option is to create your own table and join to it. That would allow you to delegate the responsibility of assigning the correct value to someone on the academic side.

Otherwise, if you must maintain this logic in a Crystal formula, then simply create a detail level formula that returns the number of credits for that row. Then, simply SUM that formula at whatever level of grouping you need (e.g. Student, DEPT, Grand Total). There is no need to accumulate the value using a variable.

Also, the detail-level formula can use OR logic to avoid so many branches. Another excellent mechanism to avoid many IF THEN branches is the use of a SELECT CASE statement.

huangapple
  • 本文由 发表于 2023年3月4日 00:02:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629344.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定