Code: Select all

```
function rtvfID(fptr)
local var = type(fptr)
if var == 'userdata' then
local ptrtype = fhGetTag(fptr)
if ptrtype == 'FAMC'
or ptrtype == 'FAMS' then
fptr = fhGetValueAsLink(fptr)
end
elseif var == 'number' then
local xptr = fhNewItemPtr()
xptr:MoveToRecordById('FAM', fptr)
fptr = xptr:Clone()
else
return
end
local mdptr = fhNewItemPtr()
local fmdat = fhNewDate()
mdptr = fhGetItemPtr(mdptr, '~.MARR.DATE:COMPACT')
if mdptr:IsNotNull() then
fmdat = fhGetValueAsDate(mdptr)
end
local ddptr = fhNewItemPtr()
local dmdat = fhNewDate()
ddptr = fhGetItemPtr(ddptr, '~.MARR.DATE:COMPACT')
if ddptr:IsNotNull() then
dmdat = fhGetValueAsDate(ddptr)
end
local _cs =
{
fID = fhGetRecordId(fptr),
fptr = fptr:Clone(),
mdptr = mdptr:Clone(),
fmdat = fmdat,
ddptr = ddptr:Clone(),
dmdat = dmdat,
}
return _cs
end -- fn matfID
function rtvFAMCtbl(iptr)
local ptrFAMC = fhNewItemPtr() -- all famc
local lnkFAMC = fhNewItemPtr() -- FAM pointer
local ptrADOP = fhNewItemPtr() -- ADOP
local lnkADOP = fhNewItemPtr()
local this = fhNewItemPtr()
local pedi = ''
local famc = {}
local fc = 0
ptrFAMC:MoveTo(iptr, '~.FAMC')
while ptrFAMC:IsNotNull() do
-- lnkFAMC = fhGetValueAsLink(ptrFAMC)
pedi = fhGetItemText(iptr, '.PEDI')
ptrADOP = fhGetItemPtr(iptr, '~.ADOP.FAMC')
if ptrADOP:IsNotNull() then
lnkADOP = fhGetValueAsLink(ptrADOP)
_ac = rtvfID(lnkADOP)
end
fc = fc + 1
famc[fc] = rtvfID(ptrFAMC)
ptrFAMC:MoveNext('SAME_TAG')
end
return famc
end -- fn rtvFAMCtbl
```

the problem lies with ptrADOP and pedi. I am not sure I can desribe it.

this is part of a much larger program.

forget for the moment that I will return a table with from 1 ... n entries in order that is not encoded yet:

famc = (will be)

{}

or

[1] {

fID = fhGetRecordId(ptrFAMC),

fpa = ['', 'PEDI' 'ADOP'],

fpp = ['', 'HUSB' 'WIFE', 'BOTH'],

}

or

[1] {

fID = fhGetRecordId(ptrFAMC),

fpa = ['', 'PEDI' 'ADOP'],

fpp = ['', 'HUSB' 'WIFE', 'BOTH'],

}

[2] {

fID = fhGetRecordId(ptrFAMC),

fpa = ['', 'PEDI' 'ADOP'],

fpp = ['', 'HUSB' 'WIFE', 'BOTH'],

}

and so on.

I cannot think of an efficient way to link either ADOP or PEDI to the correct FAMC in one fell swoop.

It seems that I sort of need a ptrCPLX = fhGetItemPtr(iptr, ptrFAMC, '~.ADOP' sort of thing... something simple is escaping me.

my tags are all in the form:

1 FAMC @F132@

2 PEDI Foster

1 ADOP

2 FAMC @F1796@

3 ADOP BOTH

Thanks.