Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Genealogy coding
Message
 
 
À
03/07/2001 08:03:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00526114
Message ID:
00526331
Vues:
16
Thank you Hilmar for the outline. It is a good starting point.


> If you really want to program in VFP, first of all, the structure: each person would need a unique ID field. Each person would also have two fields for father and mother - pointers to the IDs of the corresponding people.

You could do some things - like adding to a TreeView - without recursion. OTOH, recursion isn't really difficult to implement. Let's suppose you previously wrote functions that call other functions - a reasonable assumption, I think. All you have to do is write a function that calls itself.


* Pseudo-code
FUNCTION AddToTreeView(tnPerson)
* Command to Add to TreeView goes here
* Command to Put all direct descendants into a cursor goes here
* Condition for query: mother = tnPerson or father = tnPerson
scan
AddToTreeView(tnPerson)
endscan

Each recursive function needs a way to "end" (not recurse further), at the lowest level, to avoid infinite recursion. In this case, if no descendants are selected, the SCAN will automatically process zero records; therefore, this condition is satisfied.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform