[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:645: attempt to compare number with boolean
stack traceback:
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:645: in function 'addData'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:547: in function 'doDetail'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:194: in function <[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:193>
(...tail calls...)
[C]: in function 'iuplua.MainLoop'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:165: in function 'main'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]
I altered the function to check for this in my version to also check the months:
- added variable iAgeInMonths
- Set iAgeInMonths from callback from calcBirth
- Added logic statement to set iAgeInYears to 0 if iAgeInMonths is set
I also notice this could probably happen if an age is entered in Days only, but did not check for that.
In "function addData(ptrRecord, result, t)" added:
-- Create Birth?
if v.dr == "BIRT" then
local dtBirth = fhNewDate()
local strError
local iAgeInYears
local iAgeInMonths
if fBirthDate then
dtBirth = fBirthDate
elseif fAge then
dtBirth, strError, iAgeInYears, iAgeInMonths =
calcBirth(dDate, utils.choose(fAge == "Under one month", "1m 0d", fAge))
local dp1 = dtBirth:GetDatePt1()
--
-- IF Ages is entered as months only this will fail dues to iAgeInYears being false, added check
--
if iAgeInYears == false and iAgeInMonths then iAgeInYears=0 end
if iYear == 1841 and iAgeInYears > 15 and iAgeInYears % 5 == 0 then
-- 1841 Census ages were supposed to be rounded down to the nearest 5 years for people over 15
local sAge = tostring(iAgeInYears - 4)
local dtMax = calcBirth(dDate, sAge)
local dp2 = dtMax:GetDatePt1()
dtBirth:SetRange("between", dp1, dp2)
end