On 9/27/17 2:44 PM, Jutta Wrage wrote:
> Hi!
>
> I do not understand how to get access to the pedigree information for a child in a family.
>
> I have this in my code to print out the children in each family of a certain person as starting point:
>
> (essentials here only)
>
> my @fams = $start->fams;
> my @fams = $start->fams;
> for my $fam (@fams)
> my @children = $fam->children;
> for my $child (@children) {
> print_person($child);
> }
> }
>
> print_person is a sub to print information about an individual.
>
> As the PEDI information is in the fam record it seems I have to add something in the code above.
>
> Could somebody give me a hint, please?
That should work, but it assumes one family per person. Try this:
my @children;
foreach my $f($start->fams()) {
@children = (@children, $f->children());
}
foreach my $child(@children) {
print_person($child);
}
You may also wish to add this debugging statement:
print 'I found ', scalar(@children), ' in the family of ',
print_person($start), "\n";
-Nigel
>
> Regards,
>
> Jutta
>
--
Nigel Horne
Conductor: Rockville Brass Band, Washington Metropolitan GSO
@nigelhorne | fb/nigel.horne |
bandsman.co.uk |
concert-bands.co.uk |
www.nigelhorne.com
Unless it's for my eyes only, please use "reply all"