home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / database / 991 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.2 KB  |  60 lines

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