# 3. Create Student Term Records

### Function Objectives  


- Make a new set of [student term](https://cs.studianova.org/admin/studentterms) records for a new student until the end of the [grade span](https://cs.studianova.org/admin/gradespans).
- Make a new set of student terms when a student progresses into a new grade span.
- Make one student term record for every term the student is planning to attend in the associated grade span.


### Information Required for this Function

#### ***From the student table, we know the following fields:***

- Student's school start term - the school term the student starts in
- Grade level - the students current grade level
- Grade span - the planning horizon for that student based on their grade level
- Grade span end grade - the end grade field from the associated grade span record

#### ***From the school term we know the following fields:***

- Ordinate - the sequence of school terms, adding 1 to the ordinate finds the next record in the sequence
- Flag field - official end term is referenced from the associated [term label](https://cs.studianova.org/admin/termlabels) record

#### ***Required records (must already be created)***

- Academic year records until the end of the grade span
- School Term Records until the end of the grade span


### New Students

All functions in [2. Student Record Intake Functions ](https://bsa.lynops.com/books/personal-education-management-system/page/2-student-record-intake-functions "2. Student Record Intake Functions") must be run on a new [student](https://cs.studianova.org/admin/students) record before this function can be run.

#####   


### Recurring Students

A recurring student already has at least one student term in the system. The last student term is found by the maximum student sequence field value.

#####   


### Grade Spans

The student terms records are created from the point the student enters the school until the end of the student's assigned grade span. Grade spans are automatically updated when the student's grade level increased to land in a new grade span. When the student enters a new grade span, this function is run again.

For example, If the student is promoted from grade 5 to grade 6, and grade 6 is in a different grade span (like US middle school) then this change will trigger that all the student term records will be created until the student has completed 8th grade. The student terms for the next grade span (high school) will not be created until the student is promoted into the next grade span.

#####   


### Student Term's Student Sequence

The [student term](https://cs.studianova.org/admin/studentterms) student sequence stores the sequence of the records in the order the student will take them. Student Sequence is a continuously increasing integer value from 1, the first term at the school, until the student has graduated from all available grade levels.

For example, a student enters the fall term of kindergarten, the school has defined two required school terms. 13 years later, the student's last term (13x2 = 26) will have a student sequence of 26.

#####   


### Student Term at\_grade

The student term must store the ***predicted*** grade level of the student for that specific term in the ***at\_grade*** field. At first, the at\_grade is the starting grade level of the student, after the end of the academic year, the student's at\_grade will increase.

The at\_grade is NOT the same information as the student's current grade level. Only in for the current term will the at\_grade be the current grade level.

#####   


### Optional and Required School terms

Schools may configure optional terms, for example a summer term that students may or may not take. Student terms are made for both optional and required terms.


### Student Term Name

The student term name captures the most relevant information, the school term label, the student information, and the grade the student was at during that term. Student Term name is default field value the user may not change.

<p class="callout info"><span style="font-weight: 400;">Set the student term name to concatenate: Associated Term Name, Associated student initials, Student Code, “GL” grade level number (use at\_grade value), e</span><span style="font-weight: 400;">xample from Kassidy’s Record: **Spring 2023 KKB14 GL3**</span></p>

### Discussion

#### Trigger to increase the at\_grade

When a *<span style="text-decoration: underline;">student</span> term* is created, the record is associated to a *<span style="text-decoration: underline;">school</span> term,* which has been linked to the *term <span style="text-decoration: underline;">label</span>* record. If that term label record is flagged (flag field) as the official end term of the school year, the student's grade level will increase by one. At the end of the school year, students increase in grade level, so the at\_grade value increases for the next student term.

#### Determining the end of the grade span

A student is at the end of a grade span when their grade level is promoted to the next grade level that falls into the next grade span. The predicted grade level is stored in the student term at\_grade field. When the (at\_grade field value + 1) is greater that the end grade level in the grade span, then the function ends and no new student terms are created.

So if the student's predicted at\_grade is greater than the end grade of the associated grade\_span, then the student's predicted grade level exceeds the grade span, student term records do not need to be created for the next span.

<table border="1" id="bkmrk-calendar-functions-n-1" style="width: 100%; height: 886.844px;"><colgroup><col style="width: 20.5175%;"></col><col style="width: 11.2501%;"></col><col style="width: 68.2324%;"></col></colgroup><tbody><tr style="height: 92.8125px;"><td style="height: 92.8125px;">[3. Create Student Term Records](https://bsa.lynops.com/books/personal-education-management-system/page/3-create-student-term-records)</td><td style="height: 92.8125px;"><span style="color: rgb(224, 62, 45);">Not started</span></td><td style="height: 92.8125px;">#### 3.1 Automatically Create Student Term Records for New Students

</td></tr><tr style="height: 63.375px;"><td style="height: 63.375px;">  
</td><td style="height: 63.375px;">*Purpose*</td><td style="height: 63.375px;">*After a new student has been added, create student term records until the end of the grade span. Students can not be enrolled in classes unless there are student term records.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Trigger*</td><td style="height: 29.7969px;">*Managed by the New Student Intake Work flow.*</td></tr><tr style="height: 34.5938px;"><td style="height: 34.5938px;">  
</td><td style="height: 34.5938px;">*Conditions*</td><td style="height: 34.5938px;">*No required fields are empty.*</td></tr><tr style="height: 35.5938px;"><td style="height: 35.5938px;">  
</td><td style="height: 35.5938px;">*Sequence*</td><td style="height: 35.5938px;">*This function follows 2.0 functions during student intake work flow*</td></tr><tr style="height: 83.1875px;"><td style="height: 83.1875px;">Start with the school start term associated to the student in function 2</td><td style="height: 83.1875px;">Step 1</td><td style="height: 83.1875px;">Find the ordinate of the [student ](https://cs.studianova.org/admin/students)record school start [term](https://cs.studianova.org/admin/terms) ("previous ordinate")</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 2</td><td style="height: 35.3906px; padding-left: 40px;">Create a new [student term](https://cs.studianova.org/admin/studentterms) record</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 3</td><td style="padding-left: 40px; height: 35.3906px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to [student ](https://cs.studianova.org/admin/students)record school start [term](https://cs.studianova.org/admin/terms)</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 4</td><td style="height: 35.3906px; padding-left: 40px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to the student </td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 5</td><td style="padding-left: 40px; height: 35.3906px;">Set the [student term](https://cs.studianova.org/admin/studentterms) record at\_grade field = [student ](https://cs.studianova.org/admin/students)record current grade\_level</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 6</td><td style="padding-left: 40px; height: 35.3906px;">Set [student term](https://cs.studianova.org/admin/studentterms) record student sequence = 1</td></tr><tr style="height: 49.5938px;"><td style="height: 49.5938px;">Check if the term is the last term in year</td><td style="height: 49.5938px;">Step 7</td><td style="height: 49.5938px;">If the [student ](https://cs.studianova.org/admin/students)record school start [term](https://cs.studianova.org/admin/terms) flag = official end term, then

</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">if last term, then increase grade level</td><td style="height: 46.5938px;">Step 8</td><td style="padding-left: 40px; height: 46.5938px;">at\_grade = previous at\_grade + 1</td></tr><tr style="height: 66.3906px;"><td style="height: 66.3906px;">Check if new grade level exceeds grade span</td><td style="height: 66.3906px;">Step 9</td><td style="height: 66.3906px;">If at\_grade is greater than [student ](https://cs.studianova.org/admin/students)record [grade span](https://cs.studianova.org/admin/gradespans) end grade, then <span style="color: rgb(224, 62, 45);">**STOP**</span>

Else

</td></tr><tr style="height: 63.3906px;"><td style="height: 63.3906px;">increase the ordinate to find the next school term</td><td style="height: 63.3906px;">Step 10</td><td style="height: 63.3906px;">New ordinate = previous ordinate + 1</td></tr><tr style="height: 49.5938px;"><td style="height: 49.5938px;">Find the next school term</td><td style="height: 49.5938px;">Step 11</td><td style="height: 49.5938px;">Find the [school term](https://cs.studianova.org/admin/terms) record with the new ordinate from above - *the next term record*</td></tr><tr style="height: 35.375px;"><td style="height: 35.375px;">repeat</td><td style="height: 35.375px;">Step 12</td><td style="height: 35.375px; padding-left: 40px;">Create a new [student term](https://cs.studianova.org/admin/studentterms) record</td></tr><tr><td>  
</td><td>Step 13</td><td style="padding-left: 40px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to [school term](https://cs.studianova.org/admin/terms) record with the new ordinate (step 10)</td></tr><tr><td>  
</td><td>Step 14</td><td style="padding-left: 40px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to the student </td></tr><tr><td>  
</td><td>Step 15</td><td style="padding-left: 40px;">Set the [student term](https://cs.studianova.org/admin/studentterms) record at\_grade field = new at\_grade (step 8)</td></tr><tr><td>  
</td><td>Step 16</td><td style="padding-left: 40px;">Set [student term](https://cs.studianova.org/admin/studentterms) record student sequence = previous student sequence +1</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">check in the new school term is the end of the year</td><td style="height: 29.7969px;">Step 17</td><td style="height: 29.7969px;">If the [school term](https://cs.studianova.org/admin/terms) record with the new ordinate flag = official end grade then **<span style="color: rgb(224, 62, 45);">STOP</span>**

Else

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"> </td><td style="height: 29.7969px;">Step 18</td><td style="height: 29.7969px;">Go to Step 8</td></tr><tr><td>END</td><td>  
</td><td>  
</td></tr></tbody></table>

<table border="1" id="bkmrk-3.-create-student-te" style="width: 100%; height: 1313.77px;"><colgroup><col style="width: 20.5192%;"></col><col style="width: 11.2485%;"></col><col style="width: 68.2324%;"></col></colgroup><tbody><tr style="height: 92.8125px;"><td style="height: 92.8125px;">[3. Create Student Term Records](https://bsa.lynops.com/books/personal-education-management-system/page/3-create-student-term-records)</td><td style="height: 92.8125px;"><span style="color: rgb(224, 62, 45);">Not started</span></td><td style="height: 92.8125px;">#### 3.2 Automatically Create Student Term Records for recurring students

</td></tr><tr style="height: 63.3906px;"><td style="height: 63.3906px;">  
</td><td style="height: 63.3906px;">*Purpose*</td><td style="height: 63.3906px;">*When a student has advanced to a new grade span, create student term records until the end of the grade span. Students can not be enrolled in classes unless there are student term records.*</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">*Trigger*</td><td style="height: 29.7969px;">*Managed by the advancement workflow*</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">  
</td><td style="height: 46.5938px;">*Conditions*</td><td style="height: 46.5938px;">*No required fields are empty. There must be at least one student term record already created - from function 3.1*</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">  
</td><td style="height: 46.5938px;">*Sequence*</td><td style="height: 46.5938px;">*After a student has been advanced to a new grade level, this is part of the advancement workflow*</td></tr><tr style="height: 102.562px;"><td style="height: 102.562px;">Check grade level matches associated grade span.</td><td style="height: 102.562px;">Step 1</td><td style="height: 102.562px;">If [student ](https://cs.studianova.org/admin/students)record current grade level is not equal to [student ](https://cs.studianova.org/admin/students)record [grade span](https://cs.studianova.org/admin/gradespans) start grade then <span style="color: rgb(224, 62, 45);">**STOP**</span>

Provide user an error that student terms can not be made for this grade span.

Else

</td></tr><tr style="height: 52.1875px;"><td style="height: 52.1875px;">Find the last student term.</td><td style="height: 52.1875px;">Step 2</td><td style="height: 52.1875px;">Find the last [student term](https://cs.studianova.org/admin/studentterms) record, the [student term](https://cs.studianova.org/admin/studentterms) record with the maximum student sequence field value.</td></tr><tr style="height: 124.953px;"><td style="height: 124.953px;">Check the at\_grade</td><td style="height: 124.953px;">Step 3</td><td style="height: 124.953px;">If the at\_grade field in the last [student term](https://cs.studianova.org/admin/studentterms) record is greater than or equal to the student grade span start grade then **<span style="color: rgb(224, 62, 45);">STOP </span>**

<span style="color: rgb(0, 0, 0);">Provide user an error note that terms can not be made for this grade span.</span>

<span style="color: rgb(0, 0, 0);">Else</span>

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;">Step 4</td><td style="height: 29.7969px;"><span style="color: rgb(0, 0, 0);">set at\_grade = student current grade level</span></td></tr><tr style="height: 83.1875px;"><td style="height: 83.1875px;">Find the ordinate of the associated school term</td><td style="height: 83.1875px;">Step 5</td><td style="height: 83.1875px;">Find the ordinate of the [school term](https://cs.studianova.org/admin/terms) record associated to the last student term record found above.</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 6</td><td style="height: 35.3906px; padding-left: 40px;">Create a new [student term](https://cs.studianova.org/admin/studentterms) record</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 7</td><td style="padding-left: 40px; height: 35.3906px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to [school term](https://cs.studianova.org/admin/terms) record</td></tr><tr style="height: 35.3906px;"><td style="height: 35.3906px;">  
</td><td style="height: 35.3906px;">Step 8</td><td style="height: 35.3906px; padding-left: 40px;">Associate new [student term](https://cs.studianova.org/admin/studentterms) record to the student </td></tr><tr style="height: 52.1875px;"><td style="height: 52.1875px;">  
</td><td style="height: 52.1875px;">Step 9</td><td style="padding-left: 40px; height: 52.1875px;">Set the [student term](https://cs.studianova.org/admin/studentterms) record at\_grade field to at\_grade</td></tr><tr style="height: 52.1875px;"><td style="height: 52.1875px;">  
</td><td style="height: 52.1875px;">Step 10</td><td style="padding-left: 40px; height: 52.1875px;">Set [student term](https://cs.studianova.org/admin/studentterms) record student sequence = sequence</td></tr><tr style="height: 49.5938px;"><td style="height: 49.5938px;">Check if the term is the last term in year</td><td style="height: 49.5938px;">Step 11</td><td style="height: 49.5938px;">If the [student ](https://cs.studianova.org/admin/students)record school start [term](https://cs.studianova.org/admin/terms) flag = official end term, then

</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">if last term, then increase grade level</td><td style="height: 46.5938px;">Step 12</td><td style="padding-left: 40px; height: 46.5938px;">at\_grade = previous at\_grade + 1</td></tr><tr style="height: 66.3906px;"><td style="height: 66.3906px;">Check if new grade level exceeds grade span</td><td style="height: 66.3906px;">Step 13</td><td style="height: 66.3906px;">If at\_grade is greater than [student ](https://cs.studianova.org/admin/students)record [grade span](https://cs.studianova.org/admin/gradespans) end grade, then <span style="color: rgb(224, 62, 45);">**STOP**</span>

Else

</td></tr><tr style="height: 63.3906px;"><td style="height: 63.3906px;">increase the ordinate to find the next school term</td><td style="height: 63.3906px;">Step 14</td><td style="height: 63.3906px; padding-left: 40px;">New ordinate = previous ordinate + 1</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">increase the sequence for the next student term record</td><td style="height: 29.7969px;">Step 15</td><td style="padding-left: 40px; height: 29.7969px;">New sequence = sequence + 1</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;"> </td><td style="height: 29.7969px;">Step 16</td><td style="height: 29.7969px;">Find the School term record with the new ordinate</td></tr><tr><td>  
</td><td>Step 17</td><td>Go to Step 6</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">END</td><td style="height: 29.7969px;">  
</td><td style="height: 29.7969px;"> </td></tr></tbody></table>