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