home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.databases
- Path: sparky!uunet!munnari.oz.au!uniwa!DIALix!dent
- From: dent@DIALix.oz.au (Andrew Dent)
- Subject: Re: 4D problem
- Organization: DIALix Services, Perth, Western Australia
- Date: Mon, 17 Aug 92 12:14:14 GMT
- Message-ID: <1992Aug17.121414.610@DIALix.oz.au>
- References: <1992Aug14.214912.9278@CS.ORST.EDU>
- Lines: 49
-
-
- To create an "on-the-fly" link to two or more different databases,
- the most elegant solution I know of is based on the use of pointers
- and arrays.
-
- Note, the following is being typed in from memory so minor syntax errors
- may creep in...
-
- Firstly, let's assume you have files [zip] and [addr1] or [addr2] used
- as source for addresses, each with fields for Name, Address, City & Zip
- (they DO NOT have to have the same names or be in the same position for
- this technique to work)
-
- Note: I'm going to use >> to indicate the 4D pointer (option-\) char.
-
- Define an array to point to the relevant fields
- ARRAY POINTER (addrFlds; 2; 4)
- addrFlds{1}{1} = >>[addr1]Name
- addrFlds{1}{2} = >>[addr1]Address
-
- and so on...
- addrFlds{2}{4} := >>[addr2]Zip
-
-
- our [Zip] database has an integer field used to indicate which address
- file is relevant (ie: it always contains 1 or 2).
-
- To reference a given address, simply use
- addrFlds{[Zip]whichAddr}{1}>>
- addrFlds{[Zip]whichAddr}{2}>>
- addrFlds{[Zip]whichAddr}{3}>>
- addrFlds{[Zip]whichAddr}{4}>>
-
- This technique has lots of other applications - I've just finished a
- system for converting ArchiCad output files to a jobcosting file, which
- is totally user-defined. They can define "factors" that describe how to
- extract data, ask the user or perform a calculation. Using the above
- technique I have one master [Factors] file and a number of "variant"
- files. This is very much like object-oriented programming in that you
- can add new Factor types without changing a bit of existing code!
-
- If anyone's interested in more detail, I'll post again, enough dribbling
- for now!
-
- Andy Dent (A.D. Software - Mac & VAX programming)
- 94 Bermuda Dve, BALLAJURA Western Australia 6066
- Phone/Fax: 09 249 2719 (local) +619 249 2719 (International)
- Internet: dent@DIALix.oz.au Compuserve: 100033,3241
-
-