local chil = 0
ptrCHIL = fhGetItemPtr(thisPTR, '~.~CHIL>')
if ptrCHIL:IsNotNull() then
chil = rtvElemCount(ptrCHIL)
for intChild = 1, 99 do -- Loop through each Child instance
local ptrChild = fhGetItemPtr(ptrIndi,"~.~CHIL["..intChild.."]>")
slightly different he is doing CHIL ... CHIL
and I understand why he doesnt run over the INDI.
I understand why I run over the INDI but am trying to get a child count without going thru FAMS
I can do it thru FAMS, and have working code:
Code: Select all
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') while ptrFAMS:IsNotNull() do fam = fam + 1 ptrFAM = fhGetValueAsLink(ptrFAMS) ptrCHIL:MoveTo(ptrFAM, '~.CHIL') while ptrCHIL:IsNotNull() do chil = chil + 1 ptrCHIL:MoveNext('SAME_TAG') end ptrFAMS:MoveNext('SAME_TAG') end return chil, fam end -- fn rtvElemCount
That is, the rtvAncestors (recursive with decorations)
is immediate return
the rtvDescendants(recursive with decorations)
blinks for quite a bit-- not overlong but long for 3000 records probably 30 seconds on 64 bit early I3, as I go bigger it will be log something and I am trying to shave code times.
**NB, decorations are such things as relationship, sex, age, birth and death etc.
is there a speedier shortcut ?