TIP: Click on subject to list as thread! ANSI
echo: paradox
to: ROB GREEN
from: LEE MOST
date: 1995-06-20 07:47:00
subject: Re: Arrays

 RG> In Cobol, we called them tables, with OCCURS clauses and indexes or
 RG> subscripts.  In C, they were arrays, again with pointers.
 RG> I want to have 50 identically defined fields in a record, and reference
 RG> these fields using an offset or an index.  I don't care if the index is
 RG> relative to one or zero, but I just can't find any documentation....
 RG> For example.
 RG> Name
 RG> Qty[1]
 RG> Qty[2]
 RG> ....
 RG> Qty[50]
  In PAL, the Paradox Application Language, you can have fixed arrays like 
that, and of course you can label a field anything you like, so you can call 
a 
field "Qty-1" if you want to store them in a table, but for better database 
organization, you ought to organize your table with two fields: one for the 
data and one that would have the index number.  You'd also need a third field 
to relate it to the record number you want.
   Example:
   [fieldno]   [indexno]   [qty]
     1453          1         25
     1453          2         32
      ...        ...        ...
     1453         50         46
     1454          1         33
     1454          2         64
     1454         50         38
   The above is for holding the data in your database.  You can still 
manipulate it in the same ways you are used to in programming languages and 
spreadsheets.  To add ten percent to all fields with an index of 2, for 
instance, you can create a query like this:
   | indexno  |  qty                  |
   |    2     | _A, changeto _A * 1.1 |
   To make it look like the kind of matrix you might be used to, use the 
crosstab tool, which in the above example, would result in a table like this:
     fieldno    1   2   ...  50
      1453     25  32   ...  46
      1454     33  64   ...  38
   Hope that helps.
   -- Lee --
... The sooner you make your 1st 5000 mistakes, the sooner you can correct 
them.
--- Via Silver Xpress V3.02
---------------
* Origin: Silver Xpress [RBBS] (1:125/27)

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™.