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.
FUNCTION AddToTreeView(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.
>>Does anyone know of an algorithm in VFP to process/traverse a genealogy tree? I know it will take recursion, but I've not done that before. For example, for my great grandfather, I want to make a treeview of all his children, grand-children, great.... etc. Also, in a database which contains this data, including the children's birth dates, I need to do some processing for each parent and their children to build an age & mortality tree. Any ideas or pointing to resources for this type of thing would be helpful.
>>
>>Thanks
>
>
>Mark, make it easy on yourself. Go to
www.familysearch.org and download Personal Ancestral File. It's free. You can also download GEDCOM files from there and import them.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)