home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / 9292 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.8 KB  |  46 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!cs.utexas.edu!swrinde!ringer!lonestar.utsa.edu!moursand
  3. From: moursand@lonestar.utsa.edu (Bowen M. Moursund)
  4. Subject: Re: dBase IV hierarchical pointers - how?
  5. Message-ID: <1993Jan21.224515.8170@ringer.cs.utsa.edu>
  6. Keywords: dBase
  7. Sender: news@ringer.cs.utsa.edu
  8. Nntp-Posting-Host: lonestar.utsa.edu
  9. Organization: University of Texas at San Antonio
  10. References: <1jl6ptINNbkk@aurora.engr.LaTech.edu>
  11. Date: Thu, 21 Jan 1993 22:45:15 GMT
  12. Lines: 32
  13.  
  14. >I am scoping out a dBase IV business application which is mostly a
  15. >flat-file name and address database.  However, I also need to store some
  16. >hierarchical information concerning supervisor-supervisee relationships.
  17. >Occasionally I will need to start with a person and create a list of
  18. >supervisors between the specified person and the "big boss."
  19. >
  20. >Can I do this by simply storing a key or pointer to the supervisor record
  21. >in each person's record, then use that key or pointer to recursively
  22. >retrieve the supervisor, then his/her supervisor, and so on?  If this is
  23. >possible, it is difficult to do?
  24.  
  25. The method you suggest is probably the simplest, although it will require
  26. some programming. Add an ID and SUPERVISOR field to the name&address DBF.
  27. Populate the ID field with unique IDs, SUPERVISOR with the correct IDs,
  28. and create an index on the ID field.
  29.  
  30. To display the chain of supervisors, bottom up, on screen:
  31.  
  32. accept "Enter ID: " to cID
  33. use the_dbf order ID
  34. seek cID
  35. * loop while the current record has a supervisor
  36. do while "" <> the_dbf->supervisor
  37.     cSubordinate = trim(the_dbf->name)
  38.     seek the_dbf->supervisor
  39.     ? cSubordinate + "'s immediate supervisor is " + the_dbf->name
  40. enddo
  41.  
  42. If you want to get fancier, store the names/IDs as retrieved to a temporary
  43. DBF and design a dBASE report based upon the temp file.
  44.  
  45. Bowen Moursund
  46.