Search code examples
crystal-reportscrystal-reports-formulas

Adding Courses together in formula in Crystal Reports


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 

Solution

  • 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.