If entire field, say PID, has no data,
then using auto-completion and selecting PID and trying to reference any sub-field of it, results with referencing to non-existing index. Iguana attempts to resolve this empty (non-existing) reference and reports an error “Index 1 is out of bounds”
Below code can be written in Translator using auto-completion but gives error:
function MapPatient(T, PID) if PID:isNull() then T.address = 'NA' else T.address = PID end return T end
This code doesn’t give error:
function MapPatient(T, PID, PV1) if not PID.isNull() then if PID:isNull() then T.address = 'NA' else T.address = PID end end return T end
Which shows that test for null has to be performed at parent level, prior to referencing any of sub-fields.