Code: Select all
function sltIRCD()
tblParm = fhPromptUserForRecordSel('INDI', 2)
if #tblParm ~= 2 then
return false
end
p1 = tblParm[1]
p2 = tblParm[2]
return true
end --fn sltIRCD
function rtvNAME(iptr)
local Name = ''
local NameSfx = ''
Name = fhGetItemText(iptr,'~.NAME:SURNAME_FIRST')
NameSfx = fhGetItemText(iptr,'~.NAME.NSFX')
Name = Name .. NameSfx
return Name
end -- fn rtvNAME
tblout = {}
cwbtw = 0
-- Main()
rc = sltIRCD()
if rc == false then
return
end
NAM1 = rtvNAME(p1)
rlt1 = fhCallBuiltInFunction('Relationship', p1, p2, 'TEXT', 1)
if rlt1 == '' then
rlt1 = 'none'
end
NAM2 = rtvNAME(p2)
rlt2 = fhCallBuiltInFunction('Relationship', p2, p1, 'TEXT', 1)
if rlt2 == '' then
rlt2 = 'none'
end
txt1 = (NAM1 .. "'s relation to " .. NAM2 .. ' is ' .. rlt1)
txt1 = txt1:gsub( ' \'s', '\'s' )
txt1 = txt1:gsub( ' ', ' ')
table.insert(tblout, txt1)
cwbtw = math.max(cwbtw, #txt1)
txt2 = (NAM2 .. "'s relation to " .. NAM1 .. ' is ' .. rlt2)
txt2 = txt2:gsub( ' \'s', '\'s' )
txt2 = txt2:gsub( ' ', ' ')
table.insert(tblout, txt2)
cwbtw = math.max(cwbtw, #txt2)
cwbtw = ((cwbtw + 1)* 4)
fhOutputResultSetColumn('Relation', 'text', tblout, #tblout,cwbtw, 'align_left')
return