Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array in an array
#9
@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.
b = b + ...
Reply


Messages In This Thread
Array in an array - by NasaCow - 02-15-2023, 12:44 AM
RE: Array in an array - by bplus - 02-15-2023, 01:55 AM
RE: Array in an array - by OldMoses - 02-15-2023, 02:43 AM
RE: Array in an array - by NasaCow - 02-15-2023, 03:17 AM
RE: Array in an array - by OldMoses - 02-15-2023, 11:02 AM
RE: Array in an array - by mnrvovrfc - 02-15-2023, 03:53 AM
RE: Array in an array - by SMcNeill - 02-15-2023, 12:59 PM
RE: Array in an array - by bplus - 02-15-2023, 05:31 PM
RE: Array in an array - by bplus - 02-16-2023, 04:25 PM
RE: Array in an array - by NasaCow - 02-17-2023, 12:03 AM
RE: Array in an array - by SpriggsySpriggs - 02-17-2023, 05:43 PM
RE: Array in an array - by Kernelpanic - 02-18-2023, 03:49 PM
RE: Array in an array - by TempodiBasic - 03-11-2023, 02:59 AM
RE: Array in an array - by bplus - 02-17-2023, 06:32 PM
RE: Array in an array - by TerryRitchie - 02-17-2023, 09:12 PM
RE: Array in an array - by SMcNeill - 02-17-2023, 11:42 PM
RE: Array in an array - by madscijr - 02-28-2023, 07:14 AM
RE: Array in an array - by mnrvovrfc - 02-17-2023, 10:57 PM
RE: Array in an array - by TerryRitchie - 02-18-2023, 02:24 AM
RE: Array in an array - by AtomicSlaughter - 02-18-2023, 09:39 AM
RE: Array in an array - by bplus - 02-18-2023, 12:47 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 09:25 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 09:41 PM
RE: Array in an array - by TempodiBasic - 02-18-2023, 10:01 PM
RE: Array in an array - by Kernelpanic - 02-18-2023, 11:07 PM
RE: Array in an array - by TempodiBasic - 02-19-2023, 01:46 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 12:19 AM
RE: Array in an array - by bplus - 02-21-2023, 01:07 AM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 05:13 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 02:26 PM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 02:54 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 01:18 AM
RE: Array in an array - by TempodiBasic - 02-21-2023, 02:37 PM
RE: Array in an array - by bplus - 02-21-2023, 02:16 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 06:04 PM
RE: Array in an array - by bplus - 02-21-2023, 06:26 PM
RE: Array in an array - by mnrvovrfc - 02-21-2023, 10:24 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 05:59 PM
RE: Array in an array - by bplus - 02-21-2023, 06:33 PM
RE: Array in an array - by bplus - 02-21-2023, 06:42 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 06:45 PM
RE: Array in an array - by bplus - 02-21-2023, 06:51 PM
RE: Array in an array - by Kernelpanic - 02-21-2023, 09:19 PM
RE: Array in an array - by bplus - 02-21-2023, 11:13 PM
RE: Array in an array - by TempodiBasic - 02-22-2023, 09:32 AM
RE: Array in an array - by Kernelpanic - 02-27-2023, 07:05 PM
RE: Array in an array - by Kernelpanic - 02-28-2023, 03:33 PM
RE: Array in an array - by madscijr - 02-28-2023, 06:24 PM
RE: Array in an array - by TempodiBasic - 03-11-2023, 02:23 PM
RE: Array in an array - by Kernelpanic - 02-28-2023, 11:14 PM
RE: Array in an array - by madscijr - 03-01-2023, 02:13 AM
RE: Array in an array - by mnrvovrfc - 03-01-2023, 03:29 AM
RE: Array in an array - by bplus - 03-01-2023, 04:00 PM
RE: Array in an array - by madscijr - 03-01-2023, 05:24 PM
RE: Array in an array - by Sprezzo - 03-02-2023, 08:34 AM
RE: Array in an array - by bplus - 03-02-2023, 05:18 PM
RE: Array in an array - by mnrvovrfc - 03-02-2023, 04:26 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 05:19 PM
RE: Array in an array - by bplus - 03-02-2023, 05:25 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 05:26 PM
RE: Array in an array - by bplus - 03-02-2023, 05:28 PM
RE: Array in an array - by Dimster - 03-02-2023, 06:05 PM
RE: Array in an array - by bplus - 03-02-2023, 06:20 PM
RE: Array in an array - by SpriggsySpriggs - 03-02-2023, 07:12 PM
RE: Array in an array - by mnrvovrfc - 03-02-2023, 10:46 PM
RE: Array in an array - by madscijr - 03-03-2023, 12:47 AM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 02:59 AM
RE: Array in an array - by madscijr - 03-03-2023, 04:24 AM
RE: Array in an array - by mnrvovrfc - 03-03-2023, 07:22 AM
RE: Array in an array - by mnrvovrfc - 03-03-2023, 07:11 AM
RE: Array in an array - by vince - 03-03-2023, 10:07 AM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 01:02 PM
RE: Array in an array - by madscijr - 03-03-2023, 03:06 PM
RE: Array in an array - by vince - 03-03-2023, 03:17 PM
RE: Array in an array - by SpriggsySpriggs - 03-03-2023, 03:25 PM
RE: Array in an array - by mnrvovrfc - 03-11-2023, 06:22 PM
RE: Array in an array - by NasaCow - 03-13-2023, 03:29 AM
RE: Array in an array - by TempodiBasic - 04-02-2023, 10:14 PM
RE: Array in an array - by NasaCow - 04-06-2023, 02:37 AM
RE: Array in an array - by TempodiBasic - 04-12-2023, 10:53 AM



Users browsing this thread: 8 Guest(s)