[futurebasic] Re: [FB] Array of Records containing arrays of Records containing arrays

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Jay Reeve <jayreeve@...>
Date: Sat, 9 Dec 2006 15:06:01 -0600
Dennis,

That's what I thought, so it makes sense to me to store that number  
only once per student, not 14 times for every student every day.

I also see no reason to store the date 14 times for each student  
every day. Here's what I would recommend for your structure,  
retaining your strings. It brings your data down to a slightly-more- 
manageable 20.5MB.

If you have any difficulty seeing how to use this without the  
redundant entries, I'll be happy to help.

_numStudents  = 2999
_numQtrGrades = 3
_numDays      = 179
_numAttFlds   = 13

begin record StudentDay
dim 8 recordDate$                  'eight digit date  12252006
dim 1 attCodeArray$[_numAttFlds]   'one character attendance code   T
end record                         '38 bytes

begin record Student
dim permNum              as long'eight digit ID number   80125468
dim 2 qtrGrade$[_numQtrGrades]     'two character grade    A+
dim yearArray[_numDays]  as StudentDay
end record                         '6,866 bytes

dim student(_numStudents)           as Student'20,598,000 bytes
dim as long studNum, qtrNum, dayNum, attNum

student.qtrGrade$[qtrNum](studNum)                       = "A+"
student.permNum$(studNum)                                = "12345678"
student.yearArray[dayNum].recordDate$(studNum)           =  "87654321"
student.yearArray[dayNum].attCodeArray$[attNum](studNum) = "T"


I understand your wanting to keep your data in "human-readable" form,  
but the fact is, computers deal only with numbers, so I don't see  
what you gain by storing a long set of ascii numbers and length bytes  
instead of much-smaller integers. You have to use the computer to  
interpret them in either case.

If this were my project, I'd probably do it something like this,  
reducing the year's entire data to 7.6Mb and simplifying access:

//=========================
' Jay's alternative

_numStudents = 2999
_numQtrGrades = 3
_numDays = 179
_numAttFlds = 13

begin record attendance
dim as char attArray[_numAttFlds]       '1-char attendance codes
end record                              '14 bytes

begin record Student
dim as long permNum                     'eight digit ID number    
80125468
dim 2 qtrGrade$[_numQtrGrades]          'two character grade    A+
dim yearArray[_numDays] as attendance
end record'2,540 bytes

dynamic student(_numStudents) as Student'7,620,000 bytes for 3000  
students
dim 8 dateStr$(_numDays)                'string representation of  
date: 1,800 bytes

dim as long studNum, qtrNum, dayNum, attNum

student.qtrGrade$[qtrNum](studNum)                  = "A+"
student.permNum(studNum)                            = 80125468
dateStr$(dayNum)                                    = "12252006"
student.yearArray[dayNum].attArray[attNum](studNum) = asc("T")

I can help with code if you want to pursue this.

//==========================

(Just my  ΒΆΒΆ)

   e-e
   =J= a  y
    "

On Dec 9, 2006, at 12:08 PM, Dennis J. Fast wrote:

> Student ID is a Permanent ID Number that the student has from K to  
> Grad(12)
>
> -----Original Message-----
> From: Jay Reeve [mailto:jayreeve@...]
> Sent: Saturday, December 09, 2006 8:07 AM
> To: futurebasic@...
> Subject: Re: [FB] Array of Records containing arrays of Records  
> containing
> arrays
>
> Dennis,
>
> Another thought.... There may be a perfectly valid reason (maybe it's
> an entry serial # rather than a student ID), but I don't see the
> purpose of storing a student's ID anew every day. Wouldn't this be
> adequate? It virtually cuts your original data size in half.
>
> _numStudents = 2999
> _numQtrGrades = 3
> _numDays = 179
> _numAttFlds = 13
>
> begin record StudentDay
> dim dateArray[_numAttFlds]     as long        'eight digit date
> 12252006
> dim attCodeArray[_numAttFlds]  as byte        'one character
> attendance code   T
> end record                                    '70 bytes
>
> begin record Student
> dim permNum                    as long        'eight digit ID
> number   80125468
> dim 2 qtrGrade$[_numQtrGrades]                'two character  
> grade    A+
> dim yearArray[_numDays]        as StudentDay
> end record                                    '12,620 bytes
>
> dim student(_numStudents)      as Student     '37,860,000 bytes
> dim as long studNum, qtrNum, dayNum, attNum
>
> student.qtrGrade$[qtrNum](studNum)                      = "A+"
> student.permNum(studNum)                                = val&
> ("12345678")
> student.yearArray[dayNum].dateArray[attNum](studNum)    = val&
> ("87654321")
> student.yearArray[dayNum].attCodeArray[attNum](studNum) = asc("T")
>
>
>
>> Dennis,
>>
>> I'm not sure about the limitation, but I suspect Bernie is correct.
>> You can stay within the limit (and improve efficiency) if you
>> convert your strings to integers. (I didn't convert the grade
>> field, because it doesn't offer a direct correlation and doesn't
>> gobble that many bytes.)
>>
>> _numStudents = 2999
>> _numQtrGrades = 3
>> _numDays = 179
>> _numAttFlds = 13
>>
>> begin record StudentDay
>> dim permNumArray[_numAttFlds]  as long    'eight digit ID number
>> 80125468
>> dim dateArray[_numAttFlds]   as long      'eight digit date  12252006
>> dim attCodeArray[_numAttFlds]  as byte    'one character attendance
>> code   T
>> end record                                '126 bytes
>>
>> begin record Student
>> dim 2 qtrGrade$[_numQtrGrades]            'two character grade    A+
>> dim yearArray[_numDays] as StudentDay
>> end record                                '22,696 bytes
>>
>> dim student(_numStudents) as Student      '68,088,000 bytes
>> dim as long studNum, qtrNum, dayNum, attNum
>>
>> student.qtrGrade$[qtrNum](studNum)                      = "A+"
>> student.yearArray[dayNum].permNumArray[attNum](studNum) = val&
>> ("12345678")
>> student.yearArray[dayNum].dateArray[attNum](studNum)    = val&
>> ("87654321")
>> student.yearArray[dayNum].attCodeArray[attNum](studNum) = asc("T")
>>
>>
>>   e-e
>>   =J= a  y
>>    "
>>
>>
>>
>> On Dec 9, 2006, at 3:01 AM, Bernie wrote:
>>
>>>
>>> Aren't FB records limited to 32K?
>>>
>>> Anyway, I think this has parens and brackets in the right place:
>>>
>>> '----------
>>> _numStudents = 2999
>>> _numQtrGrades = 3
>>> _numDays = 105// 179 days will take Student record to 55,440
>>> bytes !!!
>>> _numAttFlds = 13
>>>
>>> begin record StudentDay
>>> dim 8 permNumArray$[_numAttFlds] 'eight digit ID number   80125468
>>> dim 8 dateArray$[_numAttFlds]    'eight digit date  12252006
>>> dim 1 attCodeArray$[_numAttFlds] 'one character attendance code   T
>>> end record
>>>
>>> begin record Student
>>> dim 2 qtrGrade$[_numQtrGrades]     'two character grade    A+
>>> dim yearArray[_numDays] as StudentDay
>>> end record
>>>
>>> dim student(_numStudents) as Student
>>> dim as long studNum, qtrNum, dayNum, attNum
>>>
>>> student.qtrGrade$[qtrNum](studNum) = "A+"
>>> student.yearArray[dayNum].permNumArray$[attNum](studNum) =  
>>> "12345678"
>>> student.yearArray[dayNum].dateArray$[attNum](studNum) = "87654321"
>>> student.yearArray[dayNum].attCodeArray$[attNum](studNum) = "T"
>>> '----------
>>>
>>>
>>> An hierarchy of CFArrays/CFDictionaries is another option.
>>>
>>> Bernie
>>>
>>>
>>>
>>>
>>> On 9 Dec 2006, at 00:04, Dennis J. Fast wrote:
>>>
>>>>
>>>> I have a huge amout of data. 14 * 3 pieces of attendance
>>>> information for
>>>> 3000 students for 180 days. For each day, Each student contains 14
>>>> pieces of data that each contain 3 fields. I will be adding 4
>>>> quarter
>>>> grades to the Student record later. We are trying to coorelate
>>>> attendance and tardies to class grades. InfoSys says it is not
>>>> possible.
>>>> Balderdash...
>>>>
>>>> Can the BEGIN RECORD ... END RECORD  and the multi-dimension arrays
>>>> architecture of FB handle this kind of structured set of data?
>>>>
>>>> Here are my thoughts:
>>>>
>>>> BEGIN RECORD StudentDay
>>>>   DIM 8 PermNumArray$(14) 'eight digit ID number   80125468
>>>>   DIM 8 DateArray$(14)    'eight digit date  12252006
>>>>   DIM 1 AttCodeArray$(14) 'one character attendance code   T
>>>> END RECORD
>>>>
>>>> BEGIN RECORD Student
>>>>   DIM 2 QtrGrade$(4)     'two character grade    A+
>>>>   DIM YearArray(180) as StudentDay
>>>> END RECORD
>>>>
>>>> DIM School(3000) as Student
>>>>
>>>> 'do I have to unpack one level at a time to get down to a single
>>>> date
>>>> code?
>>>> 'Or can I directly access the deepest piece of date directly using
>>>> multiple indices?
>>>>
>>>> 'Student #124 Grade #2
>>>> Grade$ = School.QtrGrade$[1](123)
>>>>
>>>> ' I am unclear as to the type of enclosure when going three deep.
>>>> ' I want to see Student #124 Day #76 AttCode#4
>>>> Code$ = School.YearArray.AttCodeArray$ [3][75](123)
>>>>
>>>
>>> --
>>> To unsubscribe, send ANY message to: futurebasic-
>>> unsubscribe@...
>>>
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>
>
>
> __________ NOD32 1912 (20061209) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>