Re: Country Summary Help
Posted: 21 Jun 2022 11:38
Where do you actually call main?
Helping Family Historian users since 2002
https://fhug.org.uk/forum/
Code: Select all
--[[
@Title: Country of Birth Summary Report
@Type: Standard
@Author: Melanie Marsh
@Version: 0.2
@Keywords: Country, Birth, Death
@LastUpdated: 21/06/2022
@Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License
which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence)
@Description: Counts the number of births and deaths for each country used in the database.
]]
function main()
_ = true
local tblMasterCountries = {} -- Definne array of master list of countries
local tblBirthCountries = {} -- Define array for Countries of Birth
local tblDeathCountries = {} -- Define array for Countries of Death
pl = fhNewItemPtr() -- declare pointer
pl:MoveToFirstRecord("INDI") -- point to the first individual record
while pl:IsNotNull() do
-- For each Person get the Country of Birth
strBirthCountry = getCountry(fhGetItemText(pl,'%INDI.BIRT.PLAC>%'))
-- For each Person Get the Country of Death
strDeathCountry = getCountry(fhGetItemText(pl,'%INDI.DEAT.PLAC>%'))
-- Add Birth/Death Country to the Master List
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBirthCountry)
tblMasterCountries = addSelectedCountry(tblMasterCountries, strDeathCountry)
-- Add the Country of Birth to the Birth List
tblBirthCountries = addSelectedCountry(tblBirthCountries,strBirthCountry)
-- Add the Country of Death to the Death List
tblDeathCountries = addSelectedCountry(tblDeathCountries,strDeathCountry)
pl:MoveNext()
end
-- Build Tables for the result set columns for Country and Qty
local tblMasterCountry = {}
local tblBirthCount={}
local tblDeathCount = {}
ii = 0 -- line counter for result tables
for strMasterCountry, _ in pairs(tblMasterCountries) do
table.insert( tblMasterCountry,strMasterCountry)
table.insert( tblBirthCount, tblBirthCountries[strMasterCountry] or 0 )
table.insert( tblDeathCount, tblDeathCountries[strMasterCountry] or 0 )
end
local ii = #tblMasterCountry
fhOutputResultSetColumn('Country', 'text',tblMasterCountry,ii,80,'align_left',2,true)
fhOutputResultSetColumn('No of Births', 'integer', tblBirthCount,ii,40,'align_right',1,false)
fhOutputResultSetColumn('No of Deaths', 'integer', tblDeathCount,ii,40,'align_right',1,false)
end
------Additional functions
--Gets the last part of the place to get the country. Assumes that the country is after the last comma.
function getCountry(strDataReference)
-- assumes that the country is after the last comma
strCountry = fhCallBuiltInFunction("TextPart",strDataReference,-1)
if strCountry == "" then
strCountry = "~Not Set~"
end
return strCountry
end
--Adds selected country i.e.Birth or Death etc to the Master list if it doesn't exist
function addSelectedCountry(tblSelectedCountries, strSelectedCountry)
-- Add the selected Country to the selected table
if not(tblSelectedCountries[strSelectedCountry]) then
tblSelectedCountries[strSelectedCountry] = 1
else
tblSelectedCountries[strSelectedCountry] = tblSelectedCountries[strSelectedCountry] + 1
end
return tblSelectedCountries
end
-----------------Call main()
main()Great thanks. I wondered how that was happening. Thought the forum fairies were at workColeValleyGirl wrote: ↑22 Jun 2022 08:19If you use the </> icon above your post, you can format the code as code which makes it easier to read.
Code: Select all
--[[
@Title: Country of Birth Summary Report
@Type: Standard
@Author: Melanie Marsh
@Version: 0.2
@Keywords: Country, Birth, Death
@LastUpdated: 21/06/2022
@Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License
which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence)
@Description: Counts the number of births and deaths for each country used in the database.
]]
function main()
local tblMasterCountries = {} -- Definne array of master list of countries
local tblBirthCountries = {} -- Define array for Countries of Birth
local tblDeathCountries = {} -- Define array for Countries of Death
local pl
local srBirthCountry
local strDeathCountry
local strCountry
local ptrIndi
ptrIndi = fhNewItemPtr() -- declare pointer
ptrIndi:MoveToFirstRecord("INDI") -- point to the first individual record
while ptrIndi:IsNotNull() do
-- For each Person get the Country of Birth
strBirthCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BIRT.PLAC>%'))
-- For each Person Get the Country of Death
strDeathCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.DEAT.PLAC>%'))
-- Add Birth/Death Country to the Master List
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBirthCountry)
tblMasterCountries = addSelectedCountry(tblMasterCountries, strDeathCountry)
-- Add the Country of Birth to the Birth List
tblBirthCountries = addSelectedCountry(tblBirthCountries,strBirthCountry)
-- Add the Country of Death to the Death List
tblDeathCountries = addSelectedCountry(tblDeathCountries,strDeathCountry)
ptrIndi:MoveNext()
end
-- Build Tables for the result set columns for Country and Qty
local tblMasterCountry = {}
local tblBirthCount = {}
local tblDeathCount = {}
for strMasterCountry, _ in pairs(tblMasterCountries) do
table.insert( tblMasterCountry,strMasterCountry)
table.insert( tblBirthCount, tblBirthCountries[strMasterCountry] or 0 )
table.insert( tblDeathCount, tblDeathCountries[strMasterCountry] or 0 )
end
local ii = #tblMasterCountry
local project = fhGetContextInfo('CI_PROJECT_NAME')
fhOutputResultSetTitles("Country Summary Report","Country Summary Report for "..project, "Printed Date: %#x")
fhOutputResultSetColumn('Country', 'text',tblMasterCountry,ii,80,'align_left',2,true)
fhOutputResultSetColumn('No of Births', 'integer', tblBirthCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Deaths', 'integer', tblDeathCount,ii,60,'align_right',1,false)
end
------Additional functions
--Gets the last part of the place to get the country. Assumes that the country is after the last comma.
function getCountry(strPlace)
-- assumes that the country is after the last comma
strCountry = fhCallBuiltInFunction("TextPart",strPlace,-1)
if strCountry == "" then
strCountry = "~Not Set~"
end
return strCountry
end
--Adds selected country i.e.Birth or Death etc to the Master list if it doesn't exist
function addSelectedCountry(tblSelectedCountries, strSelectedCountry)
-- Add the selected Country to the selected table
if not(tblSelectedCountries[strSelectedCountry]) then
tblSelectedCountries[strSelectedCountry] = 1
else
tblSelectedCountries[strSelectedCountry] = tblSelectedCountries[strSelectedCountry] + 1
end
return tblSelectedCountries
end
-----------------Call main()
main()
Code: Select all
--[[
@Title: Country of Birth Summary Report
@Type: Standard
@Author: Melanie Marsh
@Version: 0.2
@Keywords: Country, Birth, Death
@LastUpdated: 21/06/2022
@Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License
which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence)
@Description: Counts the number of births and deaths for each country used in the database.
]]
function main()
local tblMasterCountries = {} -- Definne array of master list of countries
local tblBirthCountries = {} -- Define array for Countries of Birth
local tblDeathCountries = {} -- Define array for Countries of Death
local ptrIndi = fhNewItemPtr() -- declare pointer
ptrIndi:MoveToFirstRecord("INDI") -- point to the first individual record
while ptrIndi:IsNotNull() do
-- For each Person get the Country of Birth
local strBirthCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BIRT.PLAC>%'))
-- For each Person Get the Country of Death
local strDeathCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.DEAT.PLAC>%'))
-- Add Birth/Death Country to the Master List
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBirthCountry)
tblMasterCountries = addSelectedCountry(tblMasterCountries, strDeathCountry)
-- Add the Country of Birth to the Birth List
tblBirthCountries = addSelectedCountry(tblBirthCountries,strBirthCountry)
-- Add the Country of Death to the Death List
tblDeathCountries = addSelectedCountry(tblDeathCountries,strDeathCountry)
ptrIndi:MoveNext()
end
-- Build Tables for the result set columns for Country and Qty
local tblMasterCountry = {}
local tblBirthCount = {}
local tblDeathCount = {}
for strMasterCountry, _ in pairs(tblMasterCountries) do
table.insert( tblMasterCountry,strMasterCountry)
table.insert( tblBirthCount, tblBirthCountries[strMasterCountry] or 0 )
table.insert( tblDeathCount, tblDeathCountries[strMasterCountry] or 0 )
end
local ii = #tblMasterCountry
local project = fhGetContextInfo('CI_PROJECT_NAME')
fhOutputResultSetTitles("Country Summary Report","Country Summary Report for "..project, "Printed Date: %#x")
fhOutputResultSetColumn('Country', 'text',tblMasterCountry,ii,80,'align_left',2,true)
fhOutputResultSetColumn('No of Births', 'integer', tblBirthCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Deaths', 'integer', tblDeathCount,ii,60,'align_right',1,false)
end
------Additional functions
--Gets the last part of the place to get the country. Assumes that the country is after the last comma.
function getCountry(strPlace)
-- assumes that the country is after the last comma
local strCountry = fhCallBuiltInFunction("TextPart",strPlace,-1)
if strCountry == "" then
strCountry = "~Not Set~"
end
return strCountry
end
--Adds selected country i.e.Birth or Death etc to the Master list if it doesn't exist
function addSelectedCountry(tblSelectedCountries, strSelectedCountry)
-- Add the selected Country to the selected table
if not(tblSelectedCountries[strSelectedCountry]) then
tblSelectedCountries[strSelectedCountry] = 1
else
tblSelectedCountries[strSelectedCountry] = tblSelectedCountries[strSelectedCountry] + 1
end
return tblSelectedCountries
end
-----------------Call main()
main()
That looks much more streamlined, I will do that.tatewise wrote: ↑22 Jun 2022 12:21Yes, that is a great improvement but you can put local before the first use of each variable as you have done elsewhere like this:In case you had not realised you cannot use '%INDI.MARR.PLAC>%' because Marriage events are not held in the Individual records but in Family records linked to the Individual records.Code: Select all
--[[ @Title: Country of Birth Summary Report @Type: Standard @Author: Melanie Marsh @Version: 0.2 @Keywords: Country, Birth, Death @LastUpdated: 21/06/2022 @Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence) @Description: Counts the number of births and deaths for each country used in the database. ]] function main() local tblMasterCountries = {} -- Definne array of master list of countries local tblBirthCountries = {} -- Define array for Countries of Birth local tblDeathCountries = {} -- Define array for Countries of Death local ptrIndi = fhNewItemPtr() -- declare pointer ptrIndi:MoveToFirstRecord("INDI") -- point to the first individual record while ptrIndi:IsNotNull() do -- For each Person get the Country of Birth local strBirthCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BIRT.PLAC>%')) -- For each Person Get the Country of Death local strDeathCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.DEAT.PLAC>%')) -- Add Birth/Death Country to the Master List tblMasterCountries = addSelectedCountry(tblMasterCountries, strBirthCountry) tblMasterCountries = addSelectedCountry(tblMasterCountries, strDeathCountry) -- Add the Country of Birth to the Birth List tblBirthCountries = addSelectedCountry(tblBirthCountries,strBirthCountry) -- Add the Country of Death to the Death List tblDeathCountries = addSelectedCountry(tblDeathCountries,strDeathCountry) ptrIndi:MoveNext() end -- Build Tables for the result set columns for Country and Qty local tblMasterCountry = {} local tblBirthCount = {} local tblDeathCount = {} for strMasterCountry, _ in pairs(tblMasterCountries) do table.insert( tblMasterCountry,strMasterCountry) table.insert( tblBirthCount, tblBirthCountries[strMasterCountry] or 0 ) table.insert( tblDeathCount, tblDeathCountries[strMasterCountry] or 0 ) end local ii = #tblMasterCountry local project = fhGetContextInfo('CI_PROJECT_NAME') fhOutputResultSetTitles("Country Summary Report","Country Summary Report for "..project, "Printed Date: %#x") fhOutputResultSetColumn('Country', 'text',tblMasterCountry,ii,80,'align_left',2,true) fhOutputResultSetColumn('No of Births', 'integer', tblBirthCount,ii,60,'align_right',1,false) fhOutputResultSetColumn('No of Deaths', 'integer', tblDeathCount,ii,60,'align_right',1,false) end ------Additional functions --Gets the last part of the place to get the country. Assumes that the country is after the last comma. function getCountry(strPlace) -- assumes that the country is after the last comma local strCountry = fhCallBuiltInFunction("TextPart",strPlace,-1) if strCountry == "" then strCountry = "~Not Set~" end return strCountry end --Adds selected country i.e.Birth or Death etc to the Master list if it doesn't exist function addSelectedCountry(tblSelectedCountries, strSelectedCountry) -- Add the selected Country to the selected table if not(tblSelectedCountries[strSelectedCountry]) then tblSelectedCountries[strSelectedCountry] = 1 else tblSelectedCountries[strSelectedCountry] = tblSelectedCountries[strSelectedCountry] + 1 end return tblSelectedCountries end -----------------Call main() main()
So to find all Marriage events only once, loop through Family (FAM) records instead of Individual (INDI) records.
i.e. Use ptrFam:MoveToFirstRecord("FAM") and '%FAM.MARR.PLAC>%'
You might also want to consider Baptisms, Christenings, Burials, and Cremations.
Code: Select all
--[[
@Title: Country of Birth Summary Report
@Type: Standard
@Author: Melanie Marsh
@Version: 0.3
@Keywords: Country, Birth, Baptism, Christening, Marriage, Death, Burial
@LastUpdated: 21/06/2022
@Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License
which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence)
@Description: Counts the number of births and deaths for each country used in the database.
]]
function main()
local tblCountry = {} --Define master list of countries and events
local strBirthCountry
local strBaptismCountry
local strChristeningCountry
local strDeathCountry
local strBurialCountry
local ptrIndi = fhNewItemPtr() -- declare pointer
ptrIndi:MoveToFirstRecord("INDI") -- point to the first individual record
while ptrIndi:IsNotNull() do
-- For each Person get the Country of Birth, add to tblCountry and add a Birth event if needed
strBirthCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BIRT.PLAC>%'))
tblCountry = addCountryEvent(tblCountry,strBirthCountry,"Birth")
-- For each Person get the Country of Baptism, add to tblCountry and add a Baptism event if needed
strBaptismCountry = getCountry(fhGetItemText(ptrIndi, '%INDI.BAPM.PLAC>%'))
tblCountry = addCountryEvent(tblCountry,strBaptismCountry,"Baptism")
-- For each Person get the Country of Christening, add to tblCountry and add a Christening event if needed
strChristeningCountry = getCountry(fhGetItemText(ptrIndi, '%INDI.CHR.PLAC>%'))
tblCountry = addCountryEvent(tblCountry,strChristeningCountry,"Christening")
-- For each Person get the Country of Death, add to tblCountry and add a Death event if needed
strDeathCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.DEAT.PLAC>%'))
tblCountry = addCountryEvent(tblCountry,strDeathCountry,"Death")
-- For each Person get the Country of Burial, add to tblCountry and add a Burial event if needed
strBurialCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BURI%'))
tblCountry = addCountryEvent(tblCountry,strBurialCountry,"Burial")
ptrIndi:MoveNext()
end
--Get marriage countries
local strMarriageCountry
local ptrFam = fhNewItemPtr() -- declare family pointer
ptrFam:MoveToFirstRecord("FAM") -- point to the first family record
while ptrFam:IsNotNull() do
--For each 'family' get the country of marriage add to tblCountry and add a marriage event if needed
strMarriageCountry = getCountry(fhGetItemText(ptrFam,'%FAM.MARR.PLAC>%'))
tblCountry = addCountryEvent(tblCountry,strMarriageCountry,"Marriage")
ptrFam:MoveNext()
end
-- output to table
local ii = #tblCountry
ii = 11
local project = fhGetContextInfo('CI_PROJECT_NAME')
fhOutputResultSetTitles("Country Summary Report","Country Summary Report for "..project, "Printed Date: %#x")
fhOutputResultSetColumn('Country', 'text',tblCountry,ii,80,'align_left',2,true)
-- fhOutputResultSetColumn('No of Births', 'integer', tblCountry.Births,ii,60,'align_right',1,false)
end
------Additional functions
--Gets the last part of the place to get the country. Assumes that the country is after the last comma.
function getCountry(strPlace)
-- assumes that the country is after the last comma
local strCountry = fhCallBuiltInFunction("TextPart",strPlace,-1)
if strCountry == "" then
strCountry = "~Not Set~"
end
return strCountry
end
-------------------------------------------------------------------------------------------
--Checks if country exists, if not adds a row for country.
--Checks if country has the event i.e. birth already and if so, increases by one otherwise
--adds event with an amount of 1
-------------------------------------------------------------------------------------------
function addCountryEvent(tblCountry, strCountry,strEvent)
if not(tblCountry[strCountry]) then
tblCountry[strCountry]={}
tblCountry[strCountry][strEvent] = 1
else
if not(tblCountry[strCountry][strEvent])then
tblCountry[strCountry][strEvent] = 1
else
tblCountry[strCountry][strEvent] = tblCountry[strCountry][strEvent]+1
end
end
return tblCountry
end
-----------------Call main()
main()
Thanks Jane, I will go through this and have a lookJane wrote: ↑07 Jul 2022 13:40The result set column needs a simple flat table for each column.
Personally I tend to require fhUtils and using the included createResultSet function.
That way you can simply loop through your result table and push it over into an output set.
The instructions for use are here: http://pluginstore.family-historian.co. ... ltSet.html
Thanks for picking up the %INDI.BURI.PLAC% bit, I've corrected it.tatewise wrote: ↑07 Jul 2022 13:45As the Help for fhOutputResultSetColumn(...) says for the tblData parameter: "The table must be a simple indexed table."
Your tblCountry now is a nested structure with country name keys, so it is not a simple table indexed by integer keys.
It may be convenient to manage the data in such a structure but it must be transformed into a set of simple indexed tables for output in the Result Set.
BTW: Line 45 has %INDI.BURI% that should be %INDI.BURI.PLAC%
Code: Select all
--[[
@Title: Country of Birth Summary Report
@Type: Standard
@Author: Melanie Marsh
@Version: 0.4
@Keywords: Country, Birth, Baptism, Christening, Marriage, Death, Burial
@LastUpdated: 08/07/2022
@Licence: This plugin is copyright (c) 2022 Melanie Marsh and contributors, and is licensed under the MIT License
which is hereby incorporated by reference (see https://pluginstore.family-historian.co.uk/fh-plugin-licence)
@Description: Counts the number of births, christenings, marriages, deaths and burials for each country used in the database.
]]
function main()
local tblMasterCountries = {} -- Definne array of master list of countries
local tblBirthCountries = {} -- Define array for Countries of Birth
local tblBaptismCountries = {} -- Define array for Countries of Baptism
local tblChristeningCountries = {} -- Define array for Countries of Christenings
local tblDeathCountries = {} -- Define array for Countries of Death
local tblBurialCountries = {} -- Define array for Countries of Burial
local tblMarriageCountries = {} -- Define array for Countries of Marriage
local ptrIndi = fhNewItemPtr() -- declare pointer
ptrIndi:MoveToFirstRecord("INDI") -- point to the first individual record
while ptrIndi:IsNotNull() do
-- For each Person get the Country of Birth, add to Master and Birth List
local strBirthCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BIRT.PLAC>%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBirthCountry)
tblBirthCountries = addSelectedCountry(tblBirthCountries,strBirthCountry)
-- For each Person get the Country of Baptism, add to Master and Baptism List
local strBaptismCountry = getCountry(fhGetItemText(ptrIndi, '%INDI.BAPM.PLAC>%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBaptismCountry)
tblBaptismCountries = addSelectedCountry(tblBaptismCountries,strBaptismCountry)
-- For each Person get the Country of Christening, add to Master and Christening List
local strChristeningCountry = getCountry(fhGetItemText(ptrIndi, '%INDI.CHR.PLAC>%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strChristeningCountry)
tblChristeningCountries = addSelectedCountry(tblChristeningCountries,strChristeningCountry)
-- For each Person get the Country of Death, add to Master and Death List
local strDeathCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.DEAT.PLAC>%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strDeathCountry)
tblDeathCountries = addSelectedCountry(tblDeathCountries,strDeathCountry)
-- For each Person get the Country of Burial, add to Master and Burial List
local strBurialCountry = getCountry(fhGetItemText(ptrIndi,'%INDI.BURI.PLAC%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strBurialCountry)
tblBurialCountries = addSelectedCountry(tblBurialCountries,strBurialCountry)
ptrIndi:MoveNext()
end
--Get marriage countries
local ptrFam = fhNewItemPtr() -- declare family pointer
ptrFam:MoveToFirstRecord("FAM") -- point to the first family record
while ptrFam:IsNotNull() do
--For each 'family' get the country of marriage and add to master and marriage list
local strMarriageCountry = getCountry(fhGetItemText(ptrFam,'%FAM.MARR.PLAC>%'))
tblMasterCountries = addSelectedCountry(tblMasterCountries, strMarriageCountry)
tblMarriageCountries = addSelectedCountry(tblMarriageCountries,strMarriageCountry)
ptrFam:MoveNext()
end
-- Build Tables for the result set columns for Country and Qty
local tblMasterCountry = {}
local tblBirthCount = {}
local tblBaptismCount = {}
local tblChristeningCount = {}
local tblDeathCount = {}
local tblBurialCount = {}
local tblMarriageCount = {}
for strMasterCountry, _ in pairs(tblMasterCountries) do
table.insert( tblMasterCountry,strMasterCountry)
table.insert( tblBirthCount, tblBirthCountries[strMasterCountry] or 0 )
table.insert( tblBaptismCount, tblBaptismCountries[strMasterCountry] or 0 )
table.insert( tblChristeningCount, tblChristeningCountries[strMasterCountry] or 0 )
table.insert( tblDeathCount, tblDeathCountries[strMasterCountry] or 0 )
table.insert( tblBurialCount, tblBurialCountries[strMasterCountry] or 0 )
table.insert( tblMarriageCount, tblMarriageCountries[strMasterCountry] or 0 )
end
local ii = #tblMasterCountry
local project = fhGetContextInfo('CI_PROJECT_NAME')
fhOutputResultSetTitles("Country Summary Report","Country Summary Report for "..project, "Printed Date: %#x")
fhOutputResultSetColumn('Country', 'text',tblMasterCountry,ii,80,'align_left',2,true)
fhOutputResultSetColumn('No of Births', 'integer', tblBirthCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Baptisms', 'integer', tblBaptismCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Christenings', 'integer', tblChristeningCount,ii,70,'align_right',1,false)
fhOutputResultSetColumn('No of Marriages', 'integer', tblMarriageCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Deaths', 'integer', tblDeathCount,ii,60,'align_right',1,false)
fhOutputResultSetColumn('No of Burials', 'integer', tblBurialCount,ii,60,'align_right',1,false)
end
------Additional functions
--Gets the last part of the place to get the country. Assumes that the country is after the last comma.
function getCountry(strPlace)
-- assumes that the country is after the last comma
local strCountry = fhCallBuiltInFunction("TextPart",strPlace,-1)
if strCountry == "" then
strCountry = "~Not Set~"
end
return strCountry
end
--Adds selected country i.e.Birth or Death etc to the Master list if it doesn't exist
function addSelectedCountry(tblSelectedCountries, strSelectedCountry)
-- Add the selected Country to the selected table
if not(tblSelectedCountries[strSelectedCountry]) then
tblSelectedCountries[strSelectedCountry] = 1
else
tblSelectedCountries[strSelectedCountry] = tblSelectedCountries[strSelectedCountry] + 1
end
return tblSelectedCountries
end
-----------------Call main()
main()