02-17-2023, 12:03 AM
(02-16-2023, 04:25 PM)bplus Wrote: @NasaCow here is a sample Student UDT that can hold scores to 20 tests and do 20 Projects details with updated subs and functions to store array data into a Fixed string that can be saved to file because all UDT data is fixed size ie, no variable length strings.
Code: (Select All)Type NameListType 'Used for the student name database
PinYinName As String * 20
FirstName As String * 20
MiddleName As String * 20
LastName As String * 20
Year As Integer
Month As Integer
Day As Integer
HouseColor As String * 8
MomName As String * 30
MomPhone As String * 20 'Saved as string to support symbols and international prefixes
MomEmail As String * 38
DadName As String * 30
DadPhone As String * 20
DadEmail As String * 38
'UID As Integer ' still need?? Don't think so because tests and projects stored with eacg student
' But do have ProjectCode for connecting details of each project assigned
Tests As String * 60 ' 20 tests 3 chars per score
ProjectCodeID As String * 60 ' 20 codes at 3 chars per code this could hook up to the Project Details
ProjectPts As String * 60 ' 0 to 999 points per project allows max 20 projects
ProjectFlags As String * 60 ' 20 flag codes up to 3 digits each
ProjectFlags2 As String * 60 ' 20 more flag codes ???
ProjectNotes As String * 10240 ' thats 512 per comment, allows 20 comments for each of 20 projects
End Type
' test revised sub and function Put3 and Get3$
Dim studentTest3X20 As String * 60 ' fit 20 tests into fixed string that can be stored from UDT
Data 100,82,75,98,66
For i = 1 To 5 ' test PutTest loading the student test string with 5 tests
Read testscore
Put3 studentTest3X20, i, testscore
Next
' ok read back scores in reverse order
For i = 5 To 1 Step -1
Print Get3$(studentTest3X20, i)
Next
' 5 types above put 3 digit integers into a string that is holding data like an array
Sub Put3 (DataString As String * 60, Index As Long, IntItem As Integer) ' store 3 digits integers into a string of 20
Mid$(DataString, Index * 3 - 2, 3) = Right$(" " + _Trim$(Str$(IntItem)), 3)
End Sub
Function Get3$ (DataString As String * 60, Index As Long)
Get3$ = Mid$(DataString, Index * 3 - 2, 3)
End Function
' For space hog comments
Sub PutProjectNote (DataString As String * 10240, Index As Long, Note As String * 512) ' store 512 note into big string
Mid$(DataString, Index * 512 - 511, 512) = Note
End Sub
Function GetProjectNote$ (DataString As String * 10240, Index As Long)
GetProjectNote$ = Mid$(DataString, Index * 512 - 511, 512)
End Function
So you can store the students tests and project details with each Student File and the details of each project in another file and use a Project code number to connect the student data on project to details of project.
This is an interesting way of doing it. It is old school for sure to save space. I know if I actually PLANNED AHEAD instead of, you know, just code without much forethought, I would had not have been in this mess!
Thanks everyone for the ideas and suggestions, I am going to keep plowing ahead and see what I can get made If any of you are familar with PowerSchool's gradebook, you might know where I am going with this