CHiLL Posted May 26, 2017 Posted May 26, 2017 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?
jthompson Posted May 26, 2017 Posted May 26, 2017 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 1
jthompson Posted May 26, 2017 Posted May 26, 2017 Of course, there will be exceptions if a student joined late, repeated a year, etc. 1
CHiLL Posted May 26, 2017 Author Posted May 26, 2017 (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 May 26, 2017 by CHiLL
jthompson Posted May 26, 2017 Posted May 26, 2017 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).
Steve21 Posted May 26, 2017 Posted May 26, 2017 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
Steve21 Posted May 26, 2017 Posted May 26, 2017 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 etc Steve
Knil92 Posted June 14, 2017 Posted June 14, 2017 Would you want something like this? https://drive.google.com/open?id=0B-PHDLY1xu1nMDhZWlNPMS1RUk0 its just something I threw together real quick in visual studio. If you want I can send you the project files so you can take a look.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now