array inside an array
Posted: 06 Aug 2022 01:22
famOBJ[#famOBJ + 1] =
{
fID = _cs.fID,
FAM = FAM,
MDAT = _cs.MDAT,
DDAT = _cs.DDAT,
HUSB = HUSB,
WIFE = WIFE,
CHIL = {},
}
local lnkCHIL = fhNewItemPtr()
local ptrCHIL = fhNewItemPtr()
lnkCHIL = fhGetItemPtr(ptrFAM, '~.CHIL')
while lnkCHIL:IsNotNull() do
ptrCHIL = fhGetValueAsLink(lnkCHIL)
local chil = fhGetRecordId(ptrCHIL)
famOBJ[#famOBJ][CHIL][#CHIL + 1] = chil line 18 (235 in real code)
235: attempt to get length of global 'CHIL' (a nil value)
the same result happens for:
famOBJ[#famOBJ]['CHIL'][#CHIL + 1] = chil
famOBJ[#famOBJ].CHIL[#CHIL + 1] = chil
I have built famOBJ at 1 through 10
famOBJ => (table #1)
[1] => (table .7)
MDAT => ""
DDAT => ""
CHIL => (table .0)
FAM => "Covey, John William"
WIFE => ""
fID => 1849
HUSB => 4464
I intend to put that familys fid:[1849] children indi records in CHIL
clearly (in my mind am specifying the CHIL array that I want to build in famOBJ, and believe I am addressing it statement 235
there is some obvious and trivial error afoot here, but it escapes me. Who sees the problem?
thanks
{
fID = _cs.fID,
FAM = FAM,
MDAT = _cs.MDAT,
DDAT = _cs.DDAT,
HUSB = HUSB,
WIFE = WIFE,
CHIL = {},
}
local lnkCHIL = fhNewItemPtr()
local ptrCHIL = fhNewItemPtr()
lnkCHIL = fhGetItemPtr(ptrFAM, '~.CHIL')
while lnkCHIL:IsNotNull() do
ptrCHIL = fhGetValueAsLink(lnkCHIL)
local chil = fhGetRecordId(ptrCHIL)
famOBJ[#famOBJ][CHIL][#CHIL + 1] = chil line 18 (235 in real code)
235: attempt to get length of global 'CHIL' (a nil value)
the same result happens for:
famOBJ[#famOBJ]['CHIL'][#CHIL + 1] = chil
famOBJ[#famOBJ].CHIL[#CHIL + 1] = chil
I have built famOBJ at 1 through 10
famOBJ => (table #1)
[1] => (table .7)
MDAT => ""
DDAT => ""
CHIL => (table .0)
FAM => "Covey, John William"
WIFE => ""
fID => 1849
HUSB => 4464
I intend to put that familys fid:[1849] children indi records in CHIL
clearly (in my mind am specifying the CHIL array that I want to build in famOBJ, and believe I am addressing it statement 235
there is some obvious and trivial error afoot here, but it escapes me. Who sees the problem?
thanks