home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
TEXT
/
PDX_ALL.ZIP
/
TI505.ASC
< prev
next >
Wrap
Text File
|
1991-09-11
|
3KB
|
133 lines
PRODUCT : PARADOX NUMBER : 505
VERSION : ALL
OS : PC DOS
DATE : September 11, 1991 PAGE : 1/2
TITLE : USING THE SUM OPERATOR WITH CALCULATED FIELDS
The result of a calculated field that involves multiplication can
vary depending on how you express that calculation. Consider the
following table to be sample data.
ORDERS=*Cust ID=*===Date==*=Part #=*=Quantity=*=@ Price=*
1 | 10000 | 7/01/88 | 93821 | 10 | 5.99 |
2 | 10000 | 7/01/88 | 18281 | 7 | .99 |
3 | 10000 | 7/01/88 | 77443 | 100 | 15.89 |
4 | 12550 | 7/01/88 | 77322 | 5 | 1.55 |
5 | 12550 | 7/01/88 | 44532 | 1 | 25.99 |
6 | 13920 | 8/10/88 | 11112 | 82 | 3.54 |
Using the table above to calculate the SUM of the Quantity field
times the @ Price field can be accomplished with either of the
equations shown below.
Equation 1 = Sum([Quantity]) * Sum([@ Price])
Equation 2 = Sum([Quantity] * [@ Price])
Equation 1 produces the answer $ 11,059.75 by taking the sum of
the Quantity field for all records, which is 205, and then
multiplying that by 53.95, which is the sum of the @ price field
for all records.
The following chart shows the work that Paradox does to process
equation one.
Record Quantity @ Price_
1 10 5.99
2 7 .99
3 100 15.89
4 5 1.55
5 1 25.99
+ 82__ + 3.54_
205 * 53.95 = $ 11,059.75 <- Result
PRODUCT : PARADOX NUMBER : 505
VERSION : ALL
OS : PC DOS
DATE : September 11, 1991 PAGE : 2/2
TITLE : USING THE SUM OPERATOR WITH CALCULATED FIELDS
Equation 2 produces the answer $ 1,979.85 by taking the Quantity
field times the @ Price field for each record and then summing
all of those results.
The following chart shows the work that Paradox does to process
equation two.
Record Quantity @ Price Calculated_
1 10 * 5.99 = 59.90
2 7 * .99 = 6.93
3 100 * 15.89 = 1589.00
4 5 * 1.55 = 7.75
5 1 * 25.99 = 25.99
6 82 * 3.54 = + 290.28_
$ 1,979.85 <- Result
The final result produced by each equation is completely
different, however, both final results are correct!