* Cemetery Listing - Unique

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
Gary Carson
Famous
Posts: 162
Joined: 02 Mar 2016 17:46
Family Historian: V7
Location: Grand Island, Nebraska, USA

Cemetery Listing - Unique

Post by Gary Carson » 24 Jul 2017 16:54

I have the following plugin I have created and want to add Burial Place Lat./Long. numeric column output - %INDI.BURI[1].PLAC>LATLONG:NUMERIC% and am not just sure how to do it.

@Title: Cemetery Summary Report
@Author: Gary Carson
@LastUpdated: April 2016
@Description:
Counts and Lists All Burial Places in the File
]]

tblCemeteries = {} -- Define array for Burial Places
pi = fhNewItemPtr() -- declare pointer
pi:MoveToFirstRecord("INDI") -- point to the first Individual record
while pi:IsNotNull() do
-- For each Person Add the Burial Place to the list
strCemetery = fhGetItemText(pi,'INDI.BURI[1].PLAC>')
tblCemeteries[strCemetery] = ( tblCemeteries[strCemetery] or 0 ) + 1
pi:MoveNext()
end
-- Build Tables for the result set columns for Burial Place and Qty
tbCemetery = {}
tblcount = {}

for strCemetery, iQty in pairs(tblCemeteries) do
table.insert( tbCemetery, strCemetery )
table.insert( tblcount, iQty )
end
fhOutputResultSetTitles("Cemetery Summary Report",
"Cemetery Summary Report")
fhOutputResultSetColumn('Burial Place', 'text',tbCemetery,#tbCemetery,260,'align_left',1,true)
fhOutputResultSetColumn('Count', 'integer',tblcount,#tbCemetery,30,'align_right',1,false)
Gary
Win 10, FH 7.0.15

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Cemetery Listing - Unique

Post by Jane » 25 Jul 2017 07:21

Personally I would get the record pointer for the Place record, rather than the text and use that in the first array and then in the second loop, simply get the Location information and add that to a new array.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
Gary Carson
Famous
Posts: 162
Joined: 02 Mar 2016 17:46
Family Historian: V7
Location: Grand Island, Nebraska, USA

Re: Cemetery Listing - Unique

Post by Gary Carson » 25 Jul 2017 20:28

I need help on what code to insert and where.
Gary
Win 10, FH 7.0.15

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Cemetery Listing - Unique

Post by tatewise » 25 Jul 2017 21:20

I am not convinced that Jane's suggestion will work with the way you are counting Place name usage.

So the extra lines you need are:

tblLatLongNum = {} -- Define array for Lat/Longitude

strLatLongNum = fhGetItemText(pi,'INDI.BURI[1].PLAC>LATLONG:NUMERIC')
tblLatLongNum[strCemetery] = strLatLongNum

tbLatLong = {}

table.insert( tbLatLong, tblLatLongNum[strCemetery] )

fhOutputResultSetColumn('LatLong', 'text',tbLatLong,#tbCemetery,90,'align_right',1,false)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Gary Carson
Famous
Posts: 162
Joined: 02 Mar 2016 17:46
Family Historian: V7
Location: Grand Island, Nebraska, USA

Re: Cemetery Listing - Unique

Post by Gary Carson » 26 Jul 2017 12:18

Mike,
That got the exact result I was looking for.
Gary
Win 10, FH 7.0.15

Post Reply