Jump to content

Recommended Posts

Posted
A number of years ago, I used to work with a guy who had a VBScript that automatically calculated that a Year 7 pupil's intake was 2016, a Year 8 pupil's intake was 2015, and so on. I'm sure that the maths worked so that he did not need to change the script each year as the calculations just worked...but I can't remember or figure out how the maths worked. Does anyone have any ideas?
Posted

If year 7 is the lowest year group in the school, then

year last september + 7 - cohort = intake year

 

e.g.

To calculate a current year 9:

2016 + 7 - 9 = 2014

  • Thanks 1
Posted (edited)
If year 7 is the lowest year group in the school, then

year last september + 7 - cohort = intake year

 

e.g.

To calculate a current year 9:

2016 + 7 - 9 = 2014

 

Thanks for that, however I'm having trouble incorporating that into VB. We are basically using Visual Studio 2017 to create a form that contains a drop down list containing: Year 7, Year 8, Year 9 and Year 10. Each selected drop down would then display another list box, listing all the students in that year. Obviously the students move up years, but the intake year remains the same. Ideally I'd like to not have to revisit the script each year if possible. If I can get the basic script sorted, I can incorporate it into the project.

 

Edit: Using the calculation you posted, how would it change for other year groups?

Edited by CHiLL
Posted

 

Edit: Using the calculation you posted, how would it change for other year groups?

 

I can't help you with the VB side of things, but in calculation above you'd feed in whatever was selected in the dropdown (Year, 7, Year 8, Year 9, etc.) as the value for what I've written as 'cohort'. The 7 would be a constant, assuming that your school starts at year 7 (ours starts at year 9 because we're still three-tier).

 

The 'year last september' part might take a bit of fiddling. You essentially want to get the year value of the current date and deduct 1 from the year if it's Jan-Aug, otherwise just take the year as it is (Sep-Dec).

Posted

Unless I'm missing what you're asking, if all you want is the intake year for each group it's as simple as

 

CurrentYear - (YearGroup - 7)

As a note CurrentYear is the curric year e.g. September

 

So as an example:

2016 - 0 = Year 7 (2016)

2016 - 1 = Year 8 (2015)

2016 - 2 = Year 9 (2014)

2016 - 3 = Year 10 (2013)

2016 - 4 = Year 11 (2012)

2016 - 5 = Year 12 (2011)

2016 - 6 = Year 13 (2010)

etc

 

Steve

Posted

In regards to the vb side basically something like this:

 

       Dim thisYear As Integer

       If Month(Today) < 9 Then
           thisYear = Year(Today) - 1
       Else
           thisYear = Year(Today)
       End If

 

Would round-down the year if it's not September.

 

Then just do the calculations on the date (You could use drop-down items instead of hardcoding it):

 

       Console.WriteLine("Year 7 Intake = " + (thisYear - 0).ToString)
       Console.WriteLine("Year 8 Intake = " + (thisYear - 1).ToString)
       Console.WriteLine("Year 9 Intake = " + (thisYear - 2).ToString)
       Console.WriteLine("Year 10 Intake = " + (thisYear - 3).ToString)
       Console.WriteLine("Year 11 Intake = " + (thisYear - 4).ToString)
       Console.WriteLine("Year 12 Intake = " + (thisYear - 5).ToString)
       Console.WriteLine("Year 13 Intake = " + (thisYear - 6).ToString)

 

and would give the output:

 

Year 7 Intake = 2016
Year 8 Intake = 2015
Year 9 Intake = 2014
Year 10 Intake = 2013
Year 11 Intake = 2012
Year 12 Intake = 2011
Year 13 Intake = 2010

 

Obviously can use dropdown to select and whatnot, but being lazy :p

etc

 

Steve

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...