Array in an array
#1
Happy Year of the Rabbit. Back to work and also back to programming. The holiday break was nice....

So I am trying to rack my head how to store this. Let me show what I have and then maybe someone can call me an idiot and point out an eaiser way of making everything work  Big Grin

The gradebook:

[Image: image.png]

As we can see I am going for something a little more complicated than just enter numbers and call it a day. I want it to be flexiable. Able to add and drop students. Being pulled from the report side of the program

The student data:

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
END TYPE

The key I believe is to have a unique id number for each student (UID), positive values will be current students and deleted students will have the value made negative. So we can keep grades with names by having the grade database match this one.

Ok so far....

This is where I run into trouble, one assignment, has details and many students with multiple details. How to combine?

Assignment file (Master):
 
Code: (Select All)
TYPE MasterAssignmentType 'Each entry needs to be defined before use with slave
    ARName AS STRING * 20 'Assignment report name
    ADName AS STRING * 10 'Assignment display name (short name)
    AType AS UNSIGNED BYTE 'Assignment Type (Completeion, formative, summative, etc.)
    ACat AS STRING * 20 'Assignment Category (subject, unit, etc)
    AColor AS UNSIGNED BYTE 'Color coding assignment headers and for grouping for reports
    ACode AS UNSIGNED BYTE 'Reserved
    APts AS UNSIGNED INTEGER 'Total points allowed
END TYPE

Slave file (for student details):
Code: (Select All)
TYPE SlaveAssignmentType 'Each student would require one with use with master
    UID AS INTEGER 'UID will match the stuedent name list to match results, negative UID means deleted and we will ignore it on display and reports
    MPts AS UNSIGNED INTEGER 'Points earned for each particular students
    Flags AS UNSIGNED BYTE 'See below for codes
    Flags2 AS UNSIGNED BYTE ' Reserved
    Notes AS STRING * 512 'Comments for a student's work
END TYPE

'====================Flag codes====================
'1   - Late (Turned in late)                      |
'2   - Absent on due date (ignore due date)       |
'4   - Incomplete (turned in but not done)        |
'8   - Missing (Not turned in)                    |
'16  - Excused/Exempt                             |
'32  - Ignore score internally for avg, etc.      |
'64  - Remove from reports (ignore externally)    |
'128 - Reserved                                   |
'==================================================

Now this is where I am in trouble.

Now I could make a file for each student with the slave but that seems.... excesive. I tried to combine both with an array but, as far as I know, it doesn't work. I want to do something like SlaveFile (UIDs(40), 500) with 40 being for UIDs and 500 for the UDT SlaveFile (something like an array in an array or jagged array). I just don't know the context for this or the workaround to get what I want....

Tried it out in a smiple way and it doesn't work the way I thought it would

Code: (Select All)
OPTION _EXPLICIT

TYPE Test
    X AS INTEGER
    y AS INTEGER
    z AS STRING
END TYPE

TYPE UID
    ID AS INTEGER
END TYPE

DIM AS INTEGER abc(1 TO 4)
DIM AS Test xyz(1 TO 10, abc())

abc(3) = 2
xyz(1, abc(1)).X = 5
xyz(1, abc(2)).y = 3

PRINT xyz(1, abc(1)).X
PRINT xyz(1, abc(2)).y
PRINT abc(3)
PRINT xyz(1, abc(4)).X


Like I said, there is likely a much easier way (I can be a stubborn Polock after all and make things more complicated than I need to!) 

You guys are amazing and I look forward to your wisdom and advide!  Big Grin
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: 6 Guest(s)