For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
function rtvCHILCount(eptr)
local thisPTR = eptr:Clone()
local ptrFAMS = fhNewItemPtr()
local ptrFAM = fhNewItemPtr()
local ptrCHIL = fhNewItemPtr()
local fam = 0
local chil = 0
ptrFAMS = fhGetItemPtr(thisPTR,'~.FAMS')
if ptrFAMS:IsNull() then
return 0
end
while ptrFAMS:IsNotNull() do
fam = fam + 1
ptrFAM = fhGetValueAsLink(ptrFAMS) -- if I use ptrFAM in the moveto below, I run off the page from INDI
ptrCHIL:MoveTo(ptrFAMS, '~.CHIL>') -- if I use ptrFAMS I never find children
while ptrCHIL:IsNotNull() do
chil = chil + 1
ptrCHIL:MoveNext('SAME_TAG')
end
ptrFAMS:MoveNext('SAME_TAG')
end
return chil
end
this has got to be the easiest thing in the world, but it isn't coming to me...
Change the line near the middle to ptrCHIL:MoveTo(ptrFAM, '~.CHIL')
i.e.
Replace FAMS with FAM because you need the FAM record pointer not the FAMS tag pointer.
Replace CHIL> with CHIL because you need the CHIL tag pointer and not the INDI record pointer.
The reason it loops all INDIviduals is that CHIL> returns an INDI record pointer so the 'SAME_TAG' gets successive INDI records. If you check what is happing when debugging you should see that.
BTW: You don't need the statement below so delete it: if ptrFAMS:IsNull() then
return 0
end
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry