TIP: Click on subject to list as thread! ANSI
echo: paradox
to: ROB GREEN
from: RICH GORIN
date: 1995-06-18 23:23:00
subject: Arrays

In a message to ALL, ROB GREEN said:
RG> n Cobol, we called them tables, with OCCURS clauses and indexes or
RG>  subscripts.  In C, they were arrays, again with pointers.
RG>  
RG> I want to have 50 identically defined fields in a record, and
RG> reference these  fields using an offset or an index.  I don't care
RG> if the index is relative to  one or zero, but I just can't find any
RG> documentation....
RG>  
RG> For example.
RG>  
RG> Name
RG> Qty[1]
RG> Qty[2]
RG> ....
RG> Qty[50]
RG>  
RG>  
RG> Can someone help?
RG>   
RG> 
This is not really very efficient for a relational database.  Barring
some unusual circumstances, the best way to store that information
would be a table that would have 3 fields.  Field 1 would be the entity
identifier (customer number or whatever, that you would have had
anyway), and would relate back to your master table; Field 2 would be a
field number and would be a small integer that would handle your
subscripts.  Field 3 would contain the data.  The first two fields
would be key fields, i.e. their contents jointly would define a unique
record.  
If there are 50 fields in your array, each entity could have up to 50
records, but if some were blank or zero, there would be no reason to
create those records.
Rich
--- 
---------------
* Origin: Recovery BBS, San Francisco, CA - 415-255-2188 (1:125/9)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.