Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with Formula for Students Post Reply Post New Topic
Author Message
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Topic: Help with Formula for Students
     Posted: 09 Feb 2008 at 6:34am


I am new to Crystal Report 8.5 but I need a formual to determine students as new student for the under the very first academic year via their term while any other academic year moving they should be noted as returning student. Here is a sample of the database.

Student   Academic Year    Term
Baba       2001-02              Fall
Baba      2001-02             Spring
Baba       2002-03             Fall
Baba     2002-03             Spring
Baba    2003 Summer      Summer

Fatu    2005 Summer       Summer
Fatu    2006-07                Spring
Fatu    2007-08               Spring

Adams  2002 Summer      Summer
Adams  2004-05               Fall

From the above Sample data, I need a Formula to display the following on this students record.


Baba should be "New Student in "2001-02" in Fall and any other Academic year and terms he should be a "Returning Student"

Fatu should be "New Student in "2005 Summer" in Summer and any other Academic year and terms she should be a "Returning Student"

Adams is a new student in 2002 summer in summer term while any other year he remains a returning student
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 10 Feb 2008 at 6:48pm
If the report is grouped by student, you could add a formula which does something like this:

If {Enrolment.AcademicYear} = Minimum({Enrolment.AcademicYear}, {Enrolment.Student}) then
    "New Student"
else
    "Returning Student"

In other words, if the current record is the minimum year for the student, they must have been a new student at that point, otherwise they are a returing student.


Edited by rvink - 10 Feb 2008 at 6:49pm
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 11 Feb 2008 at 9:37am
Thank you so much . It does displays " new Student " and Returning Student but the problems are as follows

1)I cant seem to get the count of new student  and returning per Term and each Academic year

2)If they student attended Academic year 2001-2003 and then attended both Fall and Spring that formula display new student for both  term.

IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 11 Feb 2008 at 1:53pm
 1)I cant seem to get the count of new student  and returning per Term and each Academic year

Use Running Totals, you will need
- new students per term
- returning students per term
- new students per year
- returning students per year

2)If they student attended Academic year 2001-2003 and then attended both Fall and Spring that formula display new student for both  term.

Hard to say without seeing the report. It depend how you set up your groups and the format of your data. You need to create a group by student, and a way to identify which term is the earliest. It looks like your academic year and term are separate fields. Is there a numeric field you can use which considers year and term together so you can do a simple ranking to find the earliest. Otherwise you'll need to create a formula like this:

If {Enrolment.term} = "Spring" then
    {Enrolment.AcademicYear} + "A"
else if {Enrolment.term} = "Summer" then
    {Enrolment.AcademicYear} + "B"
else if {Enrolment.term} = "Fall" then
    {Enrolment.AcademicYear} + "C"

This combines the academic year and term in a single field which can be sorted in the correct order (you may need to adjust the order of the terms to suit ). Then apply the formula in my first post to this formula and it should work.



Edited by rvink - 11 Feb 2008 at 2:29pm
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 11 Feb 2008 at 4:11pm
Because the if {Enrolment.AcademicYear} = Minimum({Enrolment.AcademicYear}, {Enrolment.Student}) then
    "New Student"
else
    "Returning Student"  is a formula it does not give the option for a running total or grand total
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 16 Feb 2008 at 5:41am
Does anyone know to group them by Academic year and terms to show New Students and  Returning Student.

IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 28 Feb 2008 at 6:51am
Rvlink,

Thank you for your help on this formula.  Your initial formula gave me a stepping stone to finish the formula, it took 106 formulas to get the job done.  Once again Thank you so much.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum