I need to extract a list of children of a family in birth sequence (or as entered) in a Plugin.
I thought this would be straightforward: find the FAM record and work through the CHIL records. Trouble is that (a) not all of the children are being returned (the MoveNext only returns a child with a higher Innnn ref), and (b) my loop keeps going until all subsequent INDI records have been exhausted regardless that they are not CHIL of this FAM.
The data in the GEDCOM is:
Code: Select all
0 @F1551@ FAM 1 MARR 2 DATE 5 OCT 1748 2 PLAC Kimcote,Lutterworth,Leicestershire,England 2 SOUR @S851@ 3 DATA 4 TEXT 1748 5 CONT October 5th George Adcock of Burbage & Ann Allen of Walton: Knap.ffee. were married Ban. Pub. [i.e Walton in Knaptoft] 3 OBJE @O1999@ 4 _SEQ 1 1 HUSB @I5885@ 1 WIFE @I5895@ 1 CHIL @I5887@ 1 CHIL @I2640@ 1 CHIL @I5888@ 1 CHIL @I5889@ 1 CHIL @I5890@ 1 CHIL @I5891@ 1 CHIL @I5892@ 1 CHAN 2 DATE 24 JAN 2022 3 TIME 18:06:48
Code: Select all
local ptrFamily = fhNewItemPtr() ptrFamily:MoveToFirstRecord("FAM") -- set to the first Family record. while not ptrFamily:IsNull() do iFam = iFam + 1 -- some processing of Husband and Wife here -- CHILDREN of family (in correct sequence) This used to populate birth sequence in Individual local ptrChild = fhNewItemPtr() --child ptrChild = fhGetItemPtr(ptrFamily,"~.CHIL>") i = 0 while not ptrChild:IsNull() do i = i + 1 --DEBUG if tblFamily[iFam].familyid == 1551 then fhMessageBox('Fam= '..tblFamily[iFam].familyid..' Child='..fhGetRecordId(ptrChild)..' sequence='..i) ProgressBar.Message(iFam.." families identified") if ProgressBar.Stop() then return 'Cancelled by user'; end -- if user has cancelled end --DEBUG END tblSibSequence[tblFamily[iFam].familyid][fhGetRecordId(ptrChild)] = i ptrChild:MoveNext("SAME_TAG") -- next Child record end ptrChild:SetNull() ptrFamily:MoveNext("SAME_TAG") -- next Family record end
Undoubtedly I'm missing something, but the code is the same as the logic I have for NAMEs which works fine.
Any help warmly appreciated!