"Scott Goossen" <scottg...@carlogenetics.com> wrote in message
news:41151fd2_1@cnews...
> For instance, I was creating a database for farmers, with each agricultural
> field for each year being a master record. Then there would be child tables
> with different types of expenses for their crop inputs.
that might be part of your problem.. your table design could be *much* simpler..
one master table would do the trick..
field *
year *
other fields..
you can easily query, filter, sort, etc. from that single table..
--
Steven Green - Waldorf Maryland USA
Diamond Software Group
http://www.diamondsg.com/main.htm
Paradox Support & Sales - Corel CTech Paradox
---------------------------------------------------
Diamond Sports Gems
http://www.diamondsg.com/gemsmain.htm
Trading Cards and other Sports Memorabilia
---------------------------------------------------
> What's the best way to put the sum of a bunch of numbers from a child
> table into a field in the master table from a form?
You want the sum of some child table column actually stored in a field of
the master table? That's a bad idea for a relational model.
Never tried this, but seems like the way you are doing it is the way I
would've come up with.
--
Larry DiGiovanni
Digico, Inc.
IT Consulting and Staffing Solutions
www.digicoinc.com
Check out www.thedbcommunity.com for Paradox resources.
"Steven Green" <gre...@diamondsg.com> wrote in message
news:41156EDD...@diamondsg.com...
Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
Offices in the United States and Germany
Providing solutions to health care, business, governments and non-profits
since 1982
> The "other fields" need to be able to have more than one entry.
not for each record, they don't..
you only need one master-detail set, not one for each thingie..
"Scott Goossen" <scottg...@carlogenetics.com> wrote in message
news:41154e92$1_1@cnews...
Pesticide Date Applied Equipment Used Cost Cost/Acre
Roundup 7/16/04 Floater $1500 $20
should be in the same table as
Fertilizer Blend Date Applied Equipment Used Nitrogen Applied
Potash Applied Cost Cost/acre
46-10-5-10 5/16/04 Air Seeder 100 pounds
30 pounds $3000 $40
etc, etc?
This, of course, doesn't include everything, but should give you an idea.
The detail tables, would of course, have the field name and the crop year,
as well as a few added fields.
"Steven Green" <gre...@diamondsg.com> wrote in message
news:4117D52D...@diamondsg.com...
PutOnFld.db
PID long int key
FID long int, foreign key (from the field table this would be the field record
key, secondary index for linking)
SID long int (lookup from the Stuff you can put on a field table)
ApDate D
EID long int (lookup to the equipment table)
Cost $ (more likely this should be broken into units and cost per unit) (Cost
per acre should be calculated from the unit cost by the number of units and the
field acreage from the field table)
This would handle your examples as either the fertilizer blend would be more
fully described in the stuff to put on table or, more likely, fertilizer,
nitrogen and potash are 3 separate things you can put on and would be 3
separate records in the table. You are making it clearer you have a
normalization problem though. You might want to take a look at my Normalization
paper on our Paradox resources page (link in my signature) for more on that.
> Ok, so are you saying that ALL the detail records for the one master should
> be in one table?
just as Dennis said, yes I do.. you need to expand your concept.. again,
normalization helps a lot, once it's applied to this..
sure, there might be an extra field or two that might not be used in every
record.. but..
lookup table.. your crops.. corn, potatoes, etc..
lookup table.. your stuff (items).. fertilizer X, growth hormone Y, etc..
master.. crop, year.. details such as location, acres planted, etc..
detail.. one to many.. crop, year, item, amount, cost, etc..
> Ok, so are you saying that ALL the detail records for the one master
> should be in one table? This record
You can have
Master
|
v
Detail (inclusive of all parameters of the different detail subtypes)
Or you can do
Master
|
v
Detail (supertype)
|
------------------------------------
| | |
Subtype1 Subtype2 ... SupertypeN
(eg Fertilizer) (eg Pesticide)
In the second arrangement, attributes common to all subtypes (from your
example, Date Applied, Cost, Cost/Acre, etc) would be the common stub,
with another attribute for subtype ID (Fertilizer, Pesticide, etc), then
each of the details would be captured in a subtype-specific table.
The things you can count, aggregate, etc all belong in the supertype
details table: date, cost, etc. Everything else belongs in the
subtype-specific table. This shouldn't impact rowcounts if
reporting/querying are handled properly. If it does impact rowcounts, you
need to rethink your supertype.
--
Larry DiGiovanni
Digico, Inc
"Scott Goossen" <scottg...@carlogenetics.com> wrote in message
news:41151fd2_1@cnews...
>
Scott
"Larry DiGiovanni" <nospam@nospam> wrote in message news:4118ddc8_1@cnews...
> (snip) I've never had any formal
> instruction in this all; just learned from what others had done, and maybe
> I've been offside on a few things.
Really do check out my Normalization paper and the one on Database basics then.
I think you will find them helpful in getting up to speed on the theory and
practice of databases and some of the best practices and common pitfalls in
Paradox itself.