MoveNextSpecial provides a method to iterate through all the fields and records within a record type.
ptr:MoveNextSpecial()
The following example reads though all Individual and Family Records and searches for Dates which have Date Phrases.
-- Process through all elements in the Individual and Family Sections section tblPhraseList = {} tblFactList = {} tblRecordList = {} tblTypes = {"INDI","FAM"} -- Scan both Family and Individual Record Types pi = fhNewItemPtr() ptrFact = fhNewItemPtr() -- Fact Which Contains Date ptrOwner = fhNewItemPtr() -- Owner Which Contains Fact for iType,strTypeDesc in ipairs(tblTypes) do pi:MoveToFirstRecord(strTypeDesc) while pi:IsNotNull() do strType = fhGetTag(pi) if strType == 'DATE' then dtDate = fhGetValueAsDate(pi) strPhrase = dtDate:GetPhrase() if (strPhrase ~= nil) and (strPhrase ~= "") then ptrFact:MoveToParentItem(pi) ptrOwner:MoveToParentItem(ptrFact) table.insert(tblRecordList,ptrOwner:Clone()) -- Add to Owner Column table.insert(tblFactList,ptrFact:Clone()) -- Add to Owner Column table.insert(tblPhraseList,pi:Clone()) -- Add to Data Column end end pi:MoveNextSpecial() end end -- Send the Tables to Query Window. fhOutputResultSetColumn("Owner", "item", tblRecordList, #tblRecordList) fhOutputResultSetColumn("Fact", "item", tblFactList, #tblRecordList) fhOutputResultSetColumn("Item", "item", tblPhraseList, #tblPhraseList)