This template is running in the context of a Semester record, correct?
Presumably, the Semester Table has a [Student] column, that references a Student record, which has [Student ID] as its key column? If all that is true, you’re making your expressions far more complex than they need to be. <<_THISROW].[Student].[Student ID]>> on the first line would be 100% equivalent to simply <<[Student]>>
It appears on line 10/11 that you are successfully getting a student id, but that is from the base context. You can’t simply copy the same expression and use it within another context, like the SELECT expression on line 19.
If my assumptions above are correct, you should get rid of the “.[Student ID]” everywhere. And also try with a [_THISROW] or a [_THISROW-2] instead of [_THISROW-1].
Also, if your hierarchy is Student>Semester>Class Reg, shouldn’t the [Related Classregs] already be filtered by the Student? I feel like you shouldn’t need to be doing this SELECT in the first place.